Home Random Page


CATEGORIES:

BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism






Text Transformation

The text-transform property is used to specify uppercase and lowercase letters in a text. It can be used to turn everything into uppercase or lowercase letters, or capitalize the first letter of each word.

Text Indentation

The text-indentation property is used to specify the indentation of the first line of a text. Example p {text-indent:50px;}

Links in CSS

Links can be styled in different ways.

Styling Links

Links can be styled with any CSS property (e.g. color, font-family, background, etc.). Special for links are that they can be styled differently depending on what state they are in.

The four links states are:

· a:link - a normal, unvisited link

· a:visited - a link the user has visited

· a:hover - a link when the user mouses over it

· a:active - a link the moment it is clicked

Example

a:link {color:#FF0000;} /* unvisited link */
a:visited {color:#00FF00;} /* visited link */
a:hover {color:#FF00FF;} /* mouse over link */
a:active {color:#0000FF;} /* selected link */

Text Decoration

The text-decoration property is mostly used to remove underlines from links:

Example

a:link {text-decoration:none;}
a:visited {text-decoration:none;}
a:hover {text-decoration:underline;}
a:active {text-decoration:underline;}

Background Color

The background-color property specifies the background color for links:

Example

a:link {background-color:#B2FF99;}
a:visited {background-color:#FFFF85;}
a:hover {background-color:#FF704D;}
a:active {background-color:#FF704D;}

 

 

 

Identification and grouping of elements (class and id)

Grouping elements with class

Let's say that we have two lists of links of different grapes used for white wine and red wine. The HTML code could look like this:



<p>Grapes for white wine:</p>

<ul>

<li><a href="ri.htm">Riesling</a></li>

<li><a href="ch.htm">Chardonnay</a></li>

<li><a href="pb.htm">Pinot Blanc</a></li>

</ul>

 

<p>Grapes for red wine:</p>

<ul>

<li><a href="cs.htm">Cabernet Sauvignon</a></li>

<li><a href="me.htm">Merlot</a></li>

<li><a href="pn.htm">Pinot Noir</a></li>

</ul>

We divide the links into two categories. This is done by assigning a class to each link using the attribute class. Let us try to specify some classes in the example above:

<p>Grapes for white wine:</p>

<ul>

<li><a href="ri.htm" class="whitewine">Riesling</a></li>

<li><a href="ch.htm" class="whitewine">Chardonnay</a></li>

<li><a href="pb.htm" class="whitewine">Pinot Blanc</a></li>



</ul>

 

<p>Grapes for red wine:</p>

<ul>

<li><a href="cs.htm" class="redwine">Cabernet Sauvignon</a></li>

<li><a href="me.htm" class="redwine">Merlot</a></li>

<li><a href="pn.htm" class="redwine">Pinot Noir</a></li>

</ul>

As shown in the example you can define the properties for elements which belong to a certain class by using .classname in the style sheet of the document.


Date: 2016-01-03; view: 863


<== previous page | next page ==>
Color and background in CSS | The box model inCSS
doclecture.net - lectures - 2014-2024 year. Copyright infringement or personal data (0.007 sec.)