How to set HTML Table Width and Height

文章推薦指數: 80 %
投票人數:10人

HTML Table Width ... The width attribute specifies the width of a table or the width of a table cell. The width can be set either as an absolute value in pixels, ... HTMLTableWidth Thewidthattributespecifiesthewidthofatableorthewidthofatablecell.Thewidthcanbeseteitherasanabsolutevalueinpixels,orasinpercentage(%).Ifthewidthattributeisnotset,itwilltakesupthespaceoflongestsinglewordineachcell. Tablewidthinpixels Tablewidthinpercentage(%) Thewidthvalue100%indicatesawidthforthetablethatisthefullwidthofthebrowserwindow. HTMLSourceCode: Tablewidthis100pixel Tablewidthis100% TheaboveHTMLcodedisplaytwotables,oneis100pixelwidthandanotheroneis100%width.Firsttableisonly100pixelwidthinanychangesinbrowserwindowstate,whileothertablewillalwaysstretchthefullwidthofthewindowitisviewedin,thatisthetableautomaticallyexpandsastheuserchangesthewindowsizewhenyousetwidthin%. CellWidthorColumnwidth Youcansetthewidthofatablecellusingwidthattribute. The

widthcanbeseteitherasanabsolutevalueinpixels,orasinpercentage(%). HTMLSourceCode: Cellwidthis30% Cellwidthis70% Note:Thewidthattributeof isdeprecatedinHTML4.01. TableHeight Heightattributescanbeaddedtothetagaswellasthe
tag. Theheightattributeisnotrecognizedbycertainbrowsers,sobesuretodocrossbrowsertestingifyouarerelyingonit. CoreLangs.com HTML CSS JavaScript RelatedContents HowtoHTMLTable Headersandcaption TableBorder Tablebackground TableCellspacing TableCellpadding ColspanandRowspan TableAlign ContentAlign TagsinsideTable NestedTable TableLayout1 TableLayout2 TableLayout3 RelatedTopics HTMLIntroduction HTMLTags HTMLLinks HTMLImages HTMLTables YourWebsiteOnline


請為這篇文章評分?