DIVTaginHTML
•The<div>tag definesa divisionor a sectioninan HTMLdocument.
•The<div>tag iseasily styledbyusingthe class oridattribute.
•The HTML Content Division element (<div>) is the generic container for
flowcontent.
•It has no effect on the content or layout until styled in some way using
CSS)
Cascadingstyle-sheets(CSS)
•CreatedbyHakonLieofMITin1994
•Has become the W3C standard for controlling visual presentation of web
pages
•Cascadingstyle-sheetsarepowerfulmechanismtoaddstyletoweb
document
•Enforcestandardsanduniformity
•Createdynamiceffects
•Worksbyallowingyou tospecifyrules
AdvantagesofCSS
•Savestime
•Easytochange
•Keepconsistency
•Giveyoumorecontrolover layout
•Usestyles withJavaScript
•Makeiteasy to createa common formatfor allthe Web pages
In-lineStyleSheet
•AddstylestoeachtagwithintheHTMLfile
•Useitwhenyouneedtoformat just a single sectionina webpage
•Style attributeisusedtoaddstyle
•Example
•<h1style=“color:red;font-family:sans-sarif;”>Thisismycontent</h1>
DefiningCSSRule
Aruleconsistsof
•Aselector:elementorelements the declarationapplies to
•Declaration:howthe elementsreferredto intheselectorshouldbe styled
•Property:whichisthepropertyoftheselectedelement
•Value:which isa specificationfor this property
UsingID’s
°Use an id to distinguish something, like a paragraph, from the others in a
document
°Theidselectorisused to specifya stylefor asingle, uniqueelement
°Forexample:-
°CSSfile:
°#id_name
{style attributesandvalues}
°HTMLfile
°<tagID=id_name>
DifferencebetweenID’sandClasses
°Youcan’thave morethanonetagwiththesame IDvalue
°Youcanapply thesameClassvaluetomultipledocumenttags
°UseID's forany elementsthataresimplyusedonceona page
° OR
°Only use classes to style websites, but, when you have to use an element in
JavaScript,use an identifier
CSSFontproperties
font-family:
°Specifies the typeface or family of font that should be used
Commonvalues:
°Arial, Courier/Courier New, Georgia, Times/Times New Roman and
Verdana
Example:
h1{
font-family:arial
}
CSSFontproperties
font-size:
°Specifies the size of a font
Commonvalues:
°Inpixels(12px,20pxetc.)
°Absolutsize(small,medium,lage,x-largeetc.)
Example:
h1{
font-size:20px
}