![Web-Sites-Design-and-Programming-4計算機(jī)科學(xué)與技術(shù)-網(wǎng)站設(shè)計與編程-雙語教學(xué)課件_第1頁](http://file4.renrendoc.com/view3/M03/3A/39/wKhkFmZS4riAa_eoAADRuCzCtQY489.jpg)
![Web-Sites-Design-and-Programming-4計算機(jī)科學(xué)與技術(shù)-網(wǎng)站設(shè)計與編程-雙語教學(xué)課件_第2頁](http://file4.renrendoc.com/view3/M03/3A/39/wKhkFmZS4riAa_eoAADRuCzCtQY4892.jpg)
![Web-Sites-Design-and-Programming-4計算機(jī)科學(xué)與技術(shù)-網(wǎng)站設(shè)計與編程-雙語教學(xué)課件_第3頁](http://file4.renrendoc.com/view3/M03/3A/39/wKhkFmZS4riAa_eoAADRuCzCtQY4893.jpg)
![Web-Sites-Design-and-Programming-4計算機(jī)科學(xué)與技術(shù)-網(wǎng)站設(shè)計與編程-雙語教學(xué)課件_第4頁](http://file4.renrendoc.com/view3/M03/3A/39/wKhkFmZS4riAa_eoAADRuCzCtQY4894.jpg)
![Web-Sites-Design-and-Programming-4計算機(jī)科學(xué)與技術(shù)-網(wǎng)站設(shè)計與編程-雙語教學(xué)課件_第5頁](http://file4.renrendoc.com/view3/M03/3A/39/wKhkFmZS4riAa_eoAADRuCzCtQY4895.jpg)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
WebSitesDesignandProgrammingLecturer:LijieGuoRoom:XNA508Phone:23678517Email:2024/5/261CascadingStyleSheets(CSS)WDP[CN]第六章,148-191WDP[EN]Chapter6,188-238
P3W[CN]第三章,70-962024/5/262OverviewMotivationLevelsofstylesheetsStylespecificationformatsSelectorformsPropertyvalueformsExamplesofproperties–font,list,color,textalignment,backgroundimages2024/5/263MotivationConsiderthemanagementofacorporatewebsiteSiteidentity(look&feel-e.g.corporateimage)mustbemaintainedChangesinsiteidentitymustbeimplementedacrosstheentiresiteAmixtureofcontentandappearanceinadatasetisdifficulttomaintainStylesheetconceptfromDTPXHTMLnecessarilymixesstyleandcontent,butstylesheetshelptheseparation2024/5/264CSSCSSprovidesthemeanstocontrolandchangepresentationofXHTMLdocumentsCSSisnottechnicallyHTML,butcanbeembeddedinHTMLdocumentsStylesheetsallowyoutoimposeastandardstyleonawholedocument,orevenawholecollectionofdocumentsCSS1specificationwasdevelopedin1996CSSlevel2〔1998)revision1(“CSS2.1”)-2004,isaCandidateW3CRecommendationCSS3isunderdevelopment2024/5/265LevelsofStyleSheetsTherearethreelevelsofstylesheetsInline-specifiedforaspecificoccurrenceofatagandapplyonlytothattagThisisfine-grainstyle,whichdefeatsthepurposeofstylesheets-uniformstyleDocument-levelstylesheets-applytothewholedocumentinwhichtheyappearExternalstylesheets-canbeappliedtoanynumberofdocumentsWhenmorethanonestylesheetappliestoaspecifictaginadocument,thelowestlevelstylesheethasprecedenceInasense,thebrowsersearchesforastylepropertyspec,startingwithinline,untilitfindsone(orthereisn’tone)2024/5/266LevelsofStyleSheetsInlinestylesheetsappearinthetagitselfDocument-levelstylesheetsappearintheheadofthedocumentExternalstylesheetsareinseparatefiles,potentiallyonanyserverontheInternetWrittenastextfileswiththeMIMEtypetext/cssA<link>tagisusedtospecifythatthebrowseristofetchanduseanexternalstylesheetfile<linkrel="stylesheet"type="text/css"href="://"></link>Externalstylesheetscanbevalidatedvalidator-upload.html2024/5/267InlineStyleSpecificationStylesheetappearsasthevalueofthestyleattributeGeneralform:
style="property_1:value_1;property_2:value_2;…property_n:value_n;"2024/5/268DocumentStyleSpecificationStylesheetappearsasalistofrulesthatarethecontentofa<style>tagThe<style>tagmustincludethetypeattribute,setto"text/css"<styletype="text/css">rulelist</style>Formoftherules:selector
{property_1:value_1;property_2:value_2;…;property_n:value_n;}ThelistofrulesmustbeplacedinanHTMLcomment,becauseitisnotHTMLCommentsintherulelistmusthaveadifferentform-useCcomments(/*…*/)2024/5/269ExternalStyleSheetSpecificationFormisalistofstylerulesLikethecontentofa<style>tagfordocument-levelstylesheets2024/5/2610SimpleSelectorTheselectorisatagnameoralistoftagnames,separatedbycommasExamples:h1{font_size:24pt;}h2,h3{font_size:20pt;}ContextualselectorsApplystyleonlytoelementsinspecifiedpositioninbodyofdocumentListelementhierarchybodypb{font_size:30pt}
2024/5/2611ClassSelectorUsedtoallowdifferentoccurrencesofthesametagtohavedifferentstylespecificationsAstyleclasshasaname,whichisattachedtoatagnamep.narrow{property/valuelist}p.wide{property/valuelist}Theclassyouwantonaparticularoccurrenceofatagisspecifiedwiththeclassattributeofthetag<pclass="narrow">...</p>...<pclass="wide">...</p>2024/5/2612GenericSelectorsAgenericclasscanbedefinedifyouwantastyletoapplytomorethanonekindoftagAgenericclassmustbenamed,andthenamemustbeginwithaperiod.really-big{…}Useinbodyofdoclikenormalstyleclass
<h1class="really-big">…</h1>...<pclass="really-big">…</p>2024/5/2613idSelectorsAnidselectorallowtheapplicationofastyletoonespecificelementGeneralform:
#specific-id{property-valuelist}e.g.#section3{font-size:20}InXHMTLdoc:
<h2id=“section3”>
3.Propertiesforsale
</h2>2024/5/2614PseudoClassesPseudoclassesarestylesthatapplywhensomethinghappens,ratherthanbecausethetargetelementsimplyexistsNamesbeginwithcolonshoverclassapplieswhenthemousecursorisovertheelementfocusclassapplieswhenanelementhasfocusE.G.WDP-4/pseudo.html2024/5/2615reviewCSSSyntax2024/5/2616reviewNote:OnlyoneclassattributecanbespecifiedperXHTMLelement!DoNOTstartaclassnamewithanumber!ItwillnotworkinMozilla/Firefox.2024/5/2617reviewDoNOTstartaclassnamewithanumber!ItwillnotworkinMozilla/Firefox.<html><head><styletype="text/css">h3{text-align:left;color:black}.right{text-align:right;color:blue}#first{text-align:center;color:red}</style></head><body>
<h3class="right"id="first">Howtodisplay</h3></body></html>Howtodisplay?E.G.WDP-4/first.html2024/5/2618SelectorPRIidSelector>classSelector>Simple(tag)Selector2024/5/2619PropertiesThereare60differentpropertiesin7categories:FontsListsAlignmentoftextMarginsColorsBackgroundsBorders2024/5/2620PropertyValueFormsKeywords-left,small,…Length-numbers,maybewithdecimalpointsUnits:px–pixelsin–inchescm–centimetersmm–millimeterspt–pointspc-picas(12points)em-heightoftheletter‘m’ex-height-heightoftheletter‘x’Nospaceisallowedbetweenthenumberandtheunitspecification,e.g.1.5inisillegal!2024/5/2621PropertyValueFormsPercentage-justanumberfollowedimmediatelybyapercentsignURLvaluesurl(protocol://server/pathname)ColorsColorname,e.g.whiteHexform:#XXXXXX,e.g.#FFFFFFrgb(n1,n2,n3),e.g.rgb(255,255,255)Numberscanbedecimal(0-255)orpercentagesPropertyvaluesareinheritedbyallnestedtags,unlessoverridden2024/5/2622FontPropertiesfont-familyValueisalistoffontnames-browserusesthefirstinthelistithasfont-sizePossiblevalues:alengthnumberoraname,suchassmaller,xx-large,etc.font-styleitalic,oblique(useless),normalfont-weight-degreesofboldnessbolder,lighter,bold,normalfont
-forspecifyingalistoffontpropertiesfont:bolder14ptArialHelveticaOrdermustbe:style,weight,size,fontname(s)E.G.WDP-4/fonts.htm
、fonts2.htm2024/5/2623ListPropertieslist-style-typeOnunorderedlistslist-style-type
canbeusedtospecifytheshapeofthebullets
disc(default),square,orcircleSetitoneitherthe<ul>or<li>tag
<h3>Fruit</h3><ul><listyle="list-style-type:disc">Apple</li><listyle="list-style-type:square">Orange</li><listyle="list-style-type:circle">Pear</li></ul>CoulduseanimageforthebulletsinanunorderedlistExample:<listyle="list-style-image:url(bird.jpg)">2024/5/2624ListPropertieslist-style-typeOnorderedlistslist-style-typecanbeusedtochangethesequencevalues
PropertyvalueSequencetypeFirstfour
decimal
Arabicnumerals
1,2,3,4
upper-alpha
UclettersA,B,C,D
lower-alpha
Lclettersa,b,c,d
upper-roman
UcRomanI,II,III,IV
lower-roman
LcRomani,ii,iii,ivE.G.WDP-4/sequence_types.htm2024/5/2625ColorThecolorpropertyspecifiestheforegroundcolourofelements<styletype=“text/css”>th.red{color:red}th.orange{color:orange}</style>Thebackground-colorpropertyspecifiesthebackgroundcolourofelementsE.G.WDP-4/back_color.htm2024/5/2626AlignmentofTextThetext-indentpropertyallowsindentationTakeseitheralengthora%valueThetext-alignpropertyhasthepossiblevalues,left(thedefault),center,right,orjustifySometimeswewanttexttoflowaroundanotherelement-thefloatpropertyvaluesofleft,right,andnone
(thedefault)E.G.WDP-4/float.htm2024/5/2627BoxModel2024/5/2628BoxModel2024/5/2629BoxModel-BordersBorders–everyelementhasaborder-stylepropertyControlswhethertheelementhasaborderandifso,thestyleoftheborderborder-stylevalues:none,dotted,dashed,anddoubleborder-width–thin,medium(default),thick,oralengthvalueinpixelsBorderwidthcanbespecifiedforanyofthefourborders(e.g.,border-top-width)border-color–anycolorBordercolorcanbespecifiedforanyofthefourborders(e.g.,border-top-color)2024/5/2630BoxModel-Margin
Margin–
thespacebetweentheborderofanelementanditsneighborelementThemarginsaroundanelementcanbesetwithmargin-left,etc.-justassignthemalengthvalue<imgsrc="c210.jpg"style="float:right;margin-left:0.35in;margin-bottom:0.35in"/>2024/5/2631BoxModel-Padding
Padding–thedistancebetweenthecontentofanelementanditsborderControlledbypadding,padding-left,etc.E.G.WDP-4/borders.htmlE.G.WDP-4/marpads.html2024/5/2632BackgroundImagesThebackground-image
property
E.G.WDP-4/back_image.htm
background-repeat
propertyPossiblevalues:repeat(default),no-repeat,repeat-x,orrepeat-ybackground-positionpropertyPossiblevalues:top,center,bottom,left,orright2024/5/2633The<span>and<div>tagsOneproblemwiththefontpropertiesisthattheyapplytowholeelements,whichareoftentoolargeSolution:anewtagtodefineanelementinthecontentofalargerelement-<span>Thedefaultmeaningof<span>istoleavethecontentasitis<styletype="text/css">
.bigred{font-size:24pt;font-family:Ariel;color:red}</style
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年脫扣器自動拍打清洗機(jī)項目可行性研究報告
- 2025年玻璃濾片包裝回收箱項目可行性研究報告
- 2025至2031年中國變速箱吊掛行業(yè)投資前景及策略咨詢研究報告
- 2025至2030年中國鋼絲喉箍數(shù)據(jù)監(jiān)測研究報告
- 2025至2030年中國車輛舉升機(jī)數(shù)據(jù)監(jiān)測研究報告
- 2025至2030年圣誕熱氣球項目投資價值分析報告
- 船舶行業(yè)綠色船舶與智能船舶研發(fā)方案
- 標(biāo)準(zhǔn)設(shè)備租賃合同
- 智慧城市建設(shè)方案編制指南
- 航空餐食液氮運(yùn)輸服務(wù)協(xié)議
- 駐場保潔方案
- 中國心理衛(wèi)生協(xié)會家庭教育指導(dǎo)師參考試題庫及答案
- 智能廣告投放技術(shù)方案
- 知識產(chǎn)權(quán)保護(hù)執(zhí)法
- 高質(zhì)量社區(qū)建設(shè)的路徑與探索
- 數(shù)字化時代的酒店員工培訓(xùn):技能升級
- 足球守門員撲救技巧:撲救結(jié)合守護(hù)球門安全
- 《學(xué)術(shù)規(guī)范和論文寫作》課件全套 第1-10章 知:認(rèn)識研究與論文寫作 - 引文規(guī)范
- 起重機(jī)更換卷筒施工方案
- 01智慧物流信息技術(shù)概述
- 精神發(fā)育遲滯的護(hù)理查房
評論
0/150
提交評論