|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
你可以将许多网页的风格格式同时更新,不用再一页一页地更新了。
网页制造WEB文章简介:CSSactuallymeansCascadingStyleSheets.StylesareusedtodefinehowHTMLelementsaredisplayed.TheyareusuallystoredinSTYLESHEETSandwerefirstseenincludedinHTML4.0,withthepurposeofsolvingaproblemthatappeared.Thesearebas
FewpeoplereallyknowwhatCSSreallyis.Thatiswhyweneedtodiscussthisinthefollowingsetoftutorialsthatwewillhandoutasfastaspossible.Wewillcoverbasic,mediumandadvancedCSSinasetofCSSTutorialsthatyouwillsurelyenjoyutilizing.RememberthatyoudoneedbasicknowledgeaboutHTML/XHTMLinordertoworkwithCSS.ThisishighlyimportantandifyoudonotknowHTMLthenyoushouldfirstfocusonthatandthenonlearningfromCSSTutorials.
WhatisCSS?
CSSactuallymeansCascadingStyleSheets.StylesareusedtodefinehowHTMLelementsaredisplayed.TheyareusuallystoredinSTYLESHEETSandwerefirstseenincludedinHTML4.0,withthepurposeofsolvingaproblemthatappeared.Thesearebasicallyexternal,inthesensethattheyarenotactuallyincludedinyourHTMLcoding.ExternalStyleSheetsareusedinordertoSAVEYOUWORK.CSSfilesareutilizedtostorethemandyouneedtounderstandthatwehavetheadvantageofusingmultiplestyledefinitionsthatwilleventuallycascadeinjustone.
WhydidCSSappear?
Asalreadymentioned,CSSwasdevelopedinordertosolveaproblemwithHTML.RegularHTMLtagshavebeenbuilttodefinetheactualcontentofonedocument.WewerefacedwithsimpleHTMLtagslike<h1>,<table>,<p>etc.Therewasnoneedtouseformattingtagsbecausetheactualdocumentwastakencareofbyyourbrowser.AstimepassedwewerefacedwithbrowsersaddingHTMLattributesandtags.Thiscomplicatedeverythingandeventuallyledtodifficultyincreatingwebsites.Thestatementisextremelytruewhentalkingaboutsitesthatshowedaseparationbetweentheactualpresentationandthecontent.AsaresultofthisproblemSTYLESwereaddedtoHTML4.0byW3C.NowwecanclearlynoticethatallofthemainwebbrowsersouttheresupportCSS.
TimeSavedthroughCSS
StylesheetswillsaveyoutimebecausetheywilldefinehowsomeorallHTMLelementsaredisplayed.ThemostbasicexamplesofHTMLelements’appearancethatcanbecontrolledstandsinthecolortagandfonttag,whichappearedinHTML3.2.Inmostcasesthewebmaster/designer/adminwillstoreallstylesin.cssfiles.ThesearebasicallytheExternalStyleSheetsmentionedabove.Theactualtimesavingcomesfromthefactthatyouwilljustneedtoediton.cssfileinsteadofmanyofyourwebpages.Forinstance,letusthinkthatyouwillwanttochangethecolorofthelinksonallofyourhtmlfiles.Youwouldnormallydothisbydoingmodificationsoneverysinglefile.ThroughtheuseofCSSyouwilljustneedtomodifyONEFILE.Youwillbeabletodefineonestyleforeachwebelementthatyouwant.Thenthestylecanbeappliedtoasmanyhtmlfilesasneeded.Aglobalchangeisdoneinjustonefile.
WhatisthedealwithMultipleStylesCascadinginOne?
WedidnoticethatthereisalittleproblemwithunderstandingthisconceptsowedoneedtoaddittoourCSStutorialintroduction.Allstylesheetswillallowyoutodefineinfoaboutstyleandtheinfocanbegiveninvariousways.YoucanspecifystylesinExternalStyleSheets,inanHTMLelementinsidethewebpageorinoneHTMLelement.Thereisaposibilitytohavemorethanonestyledefinedfor1HTMLelement.Inthiscasewearefacedwithordercascading.Everystylepresentwillbereadbythebrowserandcascadeintoonenewstylessheet,whichwecanconsidervirtual.Thisisdonebyobeyingasimplelistoforderdefinedbypriority.Thewayyouseeanelementwillbegivenbytheelementwiththehighestpriority.Theorderis:
1.InlineStyle(definedinsidetheHTMLelement)
2.InternalStyleSheet(definedinsideatag)
3.ExternalStyleSheet
4.Browserdefaultsettings.
表现和内容相分离。将设计部分剥离出来放在一个独立样式文件中,你可以减少未来网页无效的可能。 |
|