Images

CSS - PART III


CSS
Style sheets are a very powerful tool for the Web site developer. They give you the chance to be completely consistent with the look and feel of your pages, while giving you much more control over the layout and design than straight HTML ever did.Tally 8.1 logo
HTML tags were originally designed to define the content of a document. They were supposed to say "This is a header", "This is a paragraph", "This is a table", by using tags like <h1>, <p>,
<table>and so on. The layout of the document was supposed to be taken care of by the browser, without using any formatting tags.


Miscellaneous
Color Value

Miscellaneous
Media
One major advantage of CSS2 over CSS1 over is that CSS2 allows you to specify how a web page is to be presented on different media: on a computer screen, on paper, on handheld devices, on television based screens, with speech synthesizers, etc.

CSS2 allows you to use a particular style sheet for a particular medium. You can have different parts for printinghandheld devicesmonitor, etc. You can also import different style sheets depending on the medium that is being used for browsing.This gives you flexibility to format your web page differently for different type of media.
There are 2 ways to specify which style sheets apply to which media types: with@media rule and the @import rule.
The @media rule
The @media rule allows you to specify different styles for different media within the same style sheet.
The css tutorial code example below tells the web browser to display a 16 pixelsarial font on the screen (with the use of the "@media screen" rule) and to display a 12 pixels Times if the page is printed (with the use of the "@media print" rule). Thefont-weight for both screen and print media is set to bold.
<html>
<head>
<style type="text/css">
body
{
@media screen
{
p.css_example {font-family: arial; font-size: 16px;}
}
@media print
{
p.css_example {font-family: times; font-size: 12px;}
}
@media screen,print
{
p.css_example {font-weight:bold}

}
</style>
</head>
<body>
<p>
This web page will have a yellow background 
</p>
</body>
</html>
The @import rule
The "@import" rule allows you to import style rules from external style sheets so that you don't have to place the complete CSS code into your html code.
The @import rule has 2 different css code formats that you can use. The following 2 lines of code are equivalent and show both "@import" syntaxes (one with "url()" and one with a bare string):
@import "CSS_tutorial.css";
@import url("css_tutorial.css");

Miscellaneous
Style Object
The Style object represents an individual style statement. The Style object can be accessed from the document or from the elements to which that style is applied.
Syntax for using the Style object properties:
document.getElementById("id").style.property="value"
The Style object property categories:
  • Background
  • Border and Margin
  • Layout
  • List
  • Misc
  • Positioning
  • Printing
  • Scrollbar
  • Table
  • Text
  • Standard
IE:
Internet Explorer, M: Mac IE only, W: Windows IE only, F: Firefox, O: Opera, W3C: World Wide Web Consortium (Internet Standard).
Background properties:
PropertyDescriptionIEFO
backgroundSets all background properties in one419
backgroundAttachmentSets whether a background-image is fixed or scrolls with the page419
backgroundColorSets the background-color of an element419
backgroundImageSets the background-image of an element419
backgroundPositionSets the starting position of a background-image4NoNo
backgroundPositionXSets the x-coordinates of the backgroundPosition property4NoNo
backgroundPositionYSets the y-coordinates of the backgroundPosition property4NoNo
backgroundRepeatSets if/how a background-image will be repeated419
Border and Margin properties:
PropertyDescriptionIEFO
borderSets all properties for the four borders in one419
borderBottomSets all properties for the bottom border in one419
borderBottomColorSets the color of the bottom border419
borderBottomStyleSets the style of the bottom border419
borderBottomWidthSets the width of the bottom border419
borderColorSets the color of all four borders (can have up to four colors)419
borderLeftSets all properties for the left border in one419
borderLeftColorSets the color of the left border419
borderLeftStyleSets the style of the left border419
borderLeftWidthSets the width of the left border419
borderRightSets all properties for the right border in one419
borderRightColorSets the color of the right border419
borderRightStyleSets the style of the right border419
borderRightWidthSets the width of the right border419
borderStyleSets the style of all four borders (can have up to four styles)419
borderTopSets all properties for the top border in one419
borderTopColorSets the color of the top border419
borderTopStyleSets the style of the top border419
borderTopWidthSets the width of the top border419
borderWidthSets the width of all four borders (can have up to four widths)419
marginSets the margins of an element (can have up to four values)419
marginBottomSets the bottom margin of an element419
marginLeftSets the left margin of an element419
marginRightSets the right margin of an element419
marginTopSets the top margin of an element419
outlineSets all outline properties in one5M19
outlineColorSets the color of the outline around an element5M19
outlineStyleSets the style of the outline around an element5M19
outlineWidthSets the width of the outline around an element5M19
paddingSets the padding of an element (can have up to four values)419
paddingBottomSets the bottom padding of an element419
paddingLeftSets the left padding of an element419
paddingRightSets the right padding of an element419
paddingTopSets the top padding of an element419
Layout properties
PropertyDescriptionIEFO
clearSets on which sides of an element other floating elements are not allowed419
clipSets the shape of an element419
contentSets meta-information5M1
counterIncrementSets a list of counter names, followed by an integer. The integer indicates by how much the counter is incremented for every occurrence of the element. The default is 15M1
counterResetSets a list of counter names, followed by an integer. The integer gives the value that the counter is set to on each occurrence of the element. The default is 05M1
cssFloatSets where an image or a text will appear (float) in another element5M19
cursorSets the type of cursor to be displayed419
directionSets the text direction of an element519
displaySets how an element will be displayed419
heightSets the height of an element419
markerOffsetSets the distance between the nearest border edges of a marker box and its principal box5M1
marksSets whether cross marks or crop marks should be rendered just outside the page box edge5M1
maxHeightSets the maximum height of an element5M19
maxWidthSets the maximum width of an element5M19
minHeightSets the minimum height of an element5M19
minWidthSets the minimum width of an element5M19
overflowSpecifies what to do with content that does not fit in an element box419
verticalAlignSets the vertical alignment of content in an element41No
visibilitySets whether or not an element should be visible419
widthSets the width of an element419
List properties
PropertyDescriptionIEFO
listStyleSets all the properties for a list in one419
listStyleImageSets an image as the list-item marker41No
listStylePositionPositions the list-item marker419
listStyleTypeSets the list-item marker type419
Misc properties
PropertyDescriptionIEFO
cssText
41
Positioning properties
PropertyDescriptionIEFO
bottomSets how far the bottom edge of an element is above/below the bottom edge of the parent element519
leftSets how far the left edge of an element is to the right/left of the left edge of the parent element419
positionPlaces an element in a static, relative, absolute or fixed position419
rightSets how far the right edge of an element is to the left/right of the right edge of the parent element519
topSets how far the top edge of an element is above/below the top edge of the parent element419
zIndexSets the stack order of an element419
Printing properties
PropertyDescription>IEFO
orphansSets the minimum number of lines for a paragraph that must be left at the bottom of a page5M19
pageSets a page type to use when displaying an element5M19
pageBreakAfterSets the page-breaking behavior after an element419
pageBreakBeforeSets the page-breaking behavior before an element419
pageBreakInsideSets the page-breaking behavior inside an element5M19
sizeSets the orientation and size of a page19
widowsSets the minimum number of lines for a paragraph that must be left at the top of a page5M19
Scrollbar properties (IE-only)
PropertyDescriptionIEFO
scrollbar3dLightColorSets the color of the left and top sides of the arrows and scroll boxes5WNoNo
scrollbarArrowColorSets the color of the arrows on a scroll bar5WNoNo
scrollbarBaseColorSets the base color of the scroll bar5WNoNo
scrollbarDarkShadowColorSets the color of the right and bottom sides of the arrows and scroll boxes5WNoNo
scrollbarFaceColorSets the front color of the scroll bar5WNoNo
scrollbarHighlightColorSets the color of the left and top sides of the arrows and scroll boxes, and the background of a scroll bar5WNoNo
scrollbarShadowColorSets the color of the right and bottom sides of the arrows and scroll boxes5WNoNo
scrollbarTrackColorSets the background color of a scroll bar5WNoNo
Table properties
PropertyDescriptionIEFO
borderCollapseSets whether the table border are collapsed into a single border or detached as in standard HTML519
borderSpacingSets the distance that separates cell borders5M19
captionSideSets the position of the table caption5MNoNo
emptyCellsSets whether or not to show empty cells in a table5M19
tableLayoutSets the algorithm used to display the table cells, rows, and columns5NoNo
Text properties
PropertyDescriptionIEFO
colorSets the color of the text419
fontSets all font properties in one419
fontFamilySets the font of an element419
fontSizeSets the font-size of an element419
fontSizeAdjustSets/adjusts the size of a text5M1No
fontStretchSets how to condense or stretch a font5MNoNo
fontStyleSets the font-style of an element419
fontVariantDisplays text in a small-caps font419
fontWeightSets the boldness of the font419
letterSpacingSets the space between characters419
lineHeightSets the distance between lines419
quotesSets which quotation marks to use in a text5M1
textAlignAligns the text419
textDecorationSets the decoration of a text419
textIndentIndents the first line of text419
textShadowSets the shadow effect of a text5M1
textTransformSets capitalization effect on a text419
unicodeBidi51
whiteSpaceSets how to handle line-breaks and white-space in a text419
wordSpacingSets the space between words in a text619
Standard Properties
PropertyDescriptionIEFO
dirSets or returns the direction of text519
langSets or returns the language code for an element519
titleSets or returns an element's advisory title519

Web Standard
Web standards and Validation
W3C is the World Wide Web Consortium, which is an independent organization that manages code standards on the web (e.g. HTMLCSSXML and others such web technologies). Microsoft, The Mozilla Foundation and many others are a part of W3C and agree upon the future developments of the standards.
If you have been working just a bit with web design, you probably know how a webpage is presented across different browsers and that there can be a big differences on different browsers. It can be very frustrating and time-consuming to create a webpage which can be viewed in MozillaInternet ExplorerOpera and all the rest of the existing browsers.
The idea of having standards is to agree upon a common denominator on how to use web technologies. A web developer has a certainty, by observing the standards, that what he or she does will work in a more appropriate manner across different platforms.
We therefore recommend that you back up the work carried out by the W3C and validate your CSS in order to observe the standard.
CSS validator
W3C has made a so-called validator which reads your stylesheet and returns a status listing errors and warnings, if your CSS does not validat; to make it easier to observe the CSS standard.
To make it easier for you to validate your stylesheet, you can do it directly from this webpage. Simply replace the URL with the URL of your stylesheet below and click to validate. You will then be informed by the W3C site if there are any errors found.




0 comments: