理论上,我们可以控制源文件上的任意元素的浮动,但由于IE浏览器的BUG,被浮动层需要首先出现在源文件上,也就是说我们把副标题放在版权和认证的前面:
<div id="footer"> <div id="altnav"> <a xhref="http://css.jorux.com/wp-admin/post.php#" mce_href="http://css.jorux.com/wp-admin/post.php#">About</a> - <a xhref="http://css.jorux.com/wp-admin/post.php#" mce_href="http://css.jorux.com/wp-admin/post.php#">Services</a> - <a xhref="http://css.jorux.com/wp-admin/post.php#" mce_href="http://css.jorux.com/wp-admin/post.php#">Portfolio</a> - <a xhref="http://css.jorux.com/wp-admin/post.php#" mce_href="http://css.jorux.com/wp-admin/post.php#">Contact Us</a> - <a xhref="http://css.jorux.com/wp-admin/post.php#" mce_href="http://css.jorux.com/wp-admin/post.php#">Terms of Trade</a> </div> Copyright © Enlighten Designs Powered by <a xhref="http://www.enlightenhosting.com/" mce_href="http://www.enlightenhosting.com/">Enlighten Hosting</a> and <a xhref="http://www.vadmin.co.nz/" mce_href="http://www.vadmin.co.nz/">Vadmin 3.0 CMS</a></div> |
刷新你的页面,你将看到如下所示:

最后我们回到内容部分:用<h2<>表现内容标题–"About","Contact us";用<p>表现段落;用</br>断行。
<div id="content"> <h2>About</h2> <p><strong>Enlighten Designs</strong> is an Internet solutions provider that specialises in front and back end development. To view some of the web sites we have created view our portfolio.</p> <p>We are currently undergoing a 'face lift', so if you have any questions or would like more information about the services we provide please feel free to contact us.</p> <h2>Contact Us</h2> <p>Phone: (07) 853 6060<br /> Fax: (07) 853 6060<br /> Email: <a xhref="mailto:info@enlighten.co.nz" mce_href="mailto:info@enlighten.co.nz">info@enlighten.co.nz</a><br /> P.O Box: 14159, Hamilton, New Zealand</p> <p><a xhref="http://css.jorux.com/wp-admin/post.php#" mce_href="http://css.jorux.com/wp-admin/post.php#">More contact information…</a></p> </div> |
刷新页面可以看到在Content层中又出现一些空白,这是由于<h2><p>标签的默认边距(margin)造成的,我们必须消除这些恼人的空白,当又不想把网页中所有的<h2><p>标签地边距都设为0,这就需要使用css的子选择器 ("child css selector"),在html的文件结构中,我们想控制的<h2><p>标签(child)是属于#content层(parent)的,因此在css文件中写入:
#content h2 { margin: 0; padding: 0; } #content p { margin: 0; padding: 0; } |
这样我们就告诉浏览器,仅仅是隶属于content层的<h2><p>标签的margin和padding的值为0! 上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >> |