Showing posts with label Styling links. Show all posts
Showing posts with label Styling links. Show all posts

Thursday 5 December 2013

CSS : TEXT COLOR


 Text Color

The color property is used to set the color of the text.
With CSS, a color is most often specified by:
  • a HEX value - like "#ff0000"
  • an RGB value - like "rgb(255,0,0)"
  • a color name - like "red"

The default color for a page is defined in the body selector.

Example

CSS : TEXT ALIGNMENT


Text Alignment

The text-align property is used to set the horizontal alignment of a text.
Text can be centered, or aligned to the left or right, or justified.
When text-align is set to "justify", each line is stretched so that every line has equal width, and the left and right margins are straight (like in magazines and newspapers).

Example
h1 {text-align:center;}
p.date {text-align:right;}
p.main {text-align:justify;}

CSS : TEXT DECORATION


Text Decoration

The text-decoration property is used to set or remove decorations from text.
The text-decoration property is mostly used to remove underlines from links for design purposes:

Example
a {text-decoration:none;}


It can also be used to decorate text:

Example




CSS : TEXT TRANSFORMATION


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.

Example

CSS : TEXT INDENTATION

CSS : list-SHORTAND PROPERTY


List - Shorthand property
It is also possible to specify all the list properties in one, single property. This is called a shorthand property.
The shorthand property used for lists, is the list-style property:


Example

ul
{
list-style: square url("sqpurple.gif");
}

When using the shorthand property, the order of the values are:
  • list-style-type
  • list-style-position (for a description, see the CSS properties table below)
  • list-style-image
It does not matter if one of the values above are missing, as long as the rest are in the specified order.




Other Topics

CSS : CROSSBROWSER SOLUTION


Crossbrowser Solution

The following example displays the image-marker equally in all browsers:


Example

ul
{
list-style-type: none;
padding: 0px;
margin: 0px;
}
ul li
{
background-image: url(sqpurple.gif);
background-repeat: no-repeat;
background-position: 0px 5px; 
padding-left: 14px; 
}

Example explained:
  • For ul:
    • Set the list-style-type to none to remove the list item marker
    • Set both padding and margin to 0px (for cross-browser compatibility)
  • For all li in ul:
    • Set the URL of the image, and show it only once (no-repeat)
    • Position the image where you want it (left 0px and down 5px)
    • Position the text in the list with padding-left
 
 
 
 

CSS : IMAGE as THE LIST ITEM MARKER


An Image as The List Item Marker

To specify an image as the list item marker, use the list-style-image property:


Example

ul
{
list-style-image: url('sqpurple.gif');
}

The example above does not display equally in all browsers. IE and Opera will display the image-marker a little bit higher than Firefox, Chrome, and Safari.
If you want the image-marker to be placed equally in all browsers, a crossbrowser solution is explained below.

CSS : TABLE BORDERS


Table Borders

To specify table borders in CSS, use the border property.
The example below specifies a black border for table, th, and td elements:

Example

table, th, td
{
border: 1px solid black;
}

Notice that the table in the example above has double borders. This is because both the table and the th/td elements have separate borders.

CSS : TEXT PROPERTIES


Text Properties

Property
Description
color
Sets the color of text
direction
Specifies the text direction/writing direction
letter-spacing
Increases or decreases the space between characters in a text
line-height
Sets the line height
text-align
Specifies the horizontal alignment of text
text-decoration
Specifies the decoration added to text
text-indent
Specifies the indentation of the first line in a text-block
text-shadow
Specifies the shadow effect added to text
text-transform
Controls the capitalization of text
unicode-bidi

vertical-align
Sets the vertical alignment of an element
white-space
Specifies how white-space inside an element is handled
word-spacing
Increases or decreases the space between words in a text

CSS : FONT FAMILIES


Font Families

In CSS, there are two types of font family names:
  • generic family - a group of font families with a similar look (like "Serif" or "Monospace")
  • font family - a specific font family (like "Times New Roman" or "Arial")
Generic family
Font family
Description
Serif
Times New Roman
Georgia
Serif fonts have small lines at the ends on some characters
Sans-serif
Arial
Verdana
"Sans" means without - these fonts do not have the lines at the ends of characters
Monospace
Courier New
Lucida Console
All monospace characters have the same width

Font Family

The font family of a text is set with the font-family property.
The font-family property should hold several font names as a "fallback" system. If the browser does not support the first font, it tries the next font.
Start with the font you want, and end with a generic family, to let the browser pick a similar font in the generic family, if no other fonts are available.
HINT: If the name of a font family is more than one word, it must be in quotation marks, like font-family: "Times New Roman".
More than one font family is specified in a comma-separated list:


Example

p{font-family:"Times New Roman", Times, serif;}


Difference Between Serif and Sans-serif Fonts

* On computer screens, sans-serif fonts are considered easier to read than serif fonts.






Other Topics


Physics basic inventions and inventors

1.Which instrument is used to measure altitudes in aircraft's ? Audiometer Ammeter Altimeter Anemometer Explanation : ...