70 likes | 195 Views
ITP 104. More divs and Layouts. Some General <div> Layout Tips. Centering: Use a style instruction of "margin: auto" in conjunction with a DEFINED width to make a div/container be "centered" within its area . Some General <div> Layout Tips. Clearing floats:
E N D
ITP 104 More divs and Layouts
Some General <div> Layout Tips • Centering: • Use a style instruction of "margin: auto" in conjunction with a DEFINED width to make a div/container be "centered" within its area.
Some General <div> Layout Tips • Clearing floats: • If you are having problems with floating elements overlapping or overrunning elements, stop and think if you need a clear:both to divide up "sections" of your page. • Clear "resets" float settings, which basically means items after a "clear:both" will wait until all current floating elements have finished/closed before the new divs appear/are laid out.
Some General <div> Layout Tips • Building "grid"-like layouts: • If you want to lay out lots of boxes evenly spaced out like a grid, you need to calculate their sizes AND their margins/paddings, then set an outer box that is that total.
Stylesheets • Stylesheets are section of html where you can save one or more style instructions under one "name". • They are located either in the "head" of a page (which is called an internal stylesheet), or in a separate file that is "linked" into a page (which is called an external stylesheet).
Stylesheets • Stylesheets start and stop with "style" tags. • Each "style" in a stylesheet starts with a name • the content of that style is defined by { } brackets.
Stylesheets – Style Types • ID: • In your stylesheet, store your style instructions under an ID (pound sign) name in the format #name ... such as #outercontainer • The object in your page with that id (such as div id="outercontainer") will automatically acquire those style settings • Class: • In your stylesheet, store your style settings under a class (period) name in the format .name ... such as .headline • Any object in the page that is set to that class will acquire those style properties, such as span class="headline" • Tag: • In your stylesheet, store your style instructions under an html tag name • ALL objects of that type in the page (img for images, div for div boxes, a for hyperlinks, etc.) will have those style properties as their new defaults