styles - About Basic CSS classes and hierarchy - not to effect all page elements -
i have following sample doing want:
<style> div { position: relative; padding-top: 30px; display: block; } div h3 { position: absolute; top: 0px; left: 0px; display: block; } div h3 { width: 200px; height: 230px; display: block; } div img { width: 200px; height: 200px; display: block; } </style> <div> <h3><a href="/xxxx/abcd.htm">linker</a></h3> <img src="/xxxx/abcd.jpg" alt="linker image" /> </div> the obvious problem affects of items on page , not needed div. how put proper class formation without losing hierarchy , having not affecting of page's elements.
thanks
use classes , ids. used solve problem - distinguish elements. ids need unique in whole document while classes can occure multiple times. 1 element can have several classes (whitespace separated list) 1 id.
<div id="unique-id" class="class1 class2 class2"> <h3 class="child-h3"><a href="/xxxx/abcd.htm">linker</a></h3> </div> and in css:
#unique-id{ ...styles } #unique-id h3, #unique-id child-h3{ /* both selectors match same element*/ ...styles } .class1{ ...styles } you can find short tutorial here: http://www.tizag.com/csst/cssid.php
also, might want selectors: http://www.w3.org/tr/css2/selector.html
Comments
Post a Comment