HTML – 使用960网格系统的CSS设计问题

HTML – 使用960网格系统的CSS设计问题,第1张

概述我正在使用 960 grid system来创建布局原型. 我想将导航和内容之间的颜色设置为#000(纯黑色),但我无法弄清楚如何.我目前得到的是: 使用此代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xm 我正在使用 960 grid system来创建布局原型.

我想将导航和内容之间的颜色设置为#000(纯黑色),但我无法弄清楚如何.我目前得到的是:

使用此代码:

<!DOCTYPE HTML PUBliC "-//W3C//DTD xhtml 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><HTML xmlns="http://www.w3.org/1999/xhtml"><head><Meta http-equiv="Content-type" content="text/HTML;charset=UTF-8" /><link rel="stylesheet" type="text/CSS" media="all" href="CSS/reset.CSS" /><link rel="stylesheet" type="text/CSS" media="all" href="CSS/text.CSS" /><link rel="stylesheet" type="text/CSS" media="all" href="CSS/960.CSS" /><link rel="stylesheet" type="text/CSS" media="all" href="CSS/custom.CSS" /><Title>The system</Title></head><body><div  ID="base">    <div  ID="header">Graphical banner</div>    <div  ID="logoutrow">logout row</div>    <div  ID="navigation">Navigation</div>    <div  ID="content">Content</div>    <div  ID="footer">Footer</div></div></body></HTML>

我的两个问题:

>如何为导航和内容之间的所有“中间”空间指定颜色?
>如果我不像this教程那样使用清晰,我的布局看起来就像我想要的那样.为什么?

对于颜色之间我尝试将它放在custom.CSS中没有成功:

div#base {    background-color: #000;}

如果你不熟悉960网格系统,但仍想尝试帮助整个960.CSS可以找到here.

两个问题都解决了

>我的第二个问题在Jan Aagaard的一篇文章中得到了解决.我没有包含XML实体并且有一个空div.它没有用,至少在firefox 3.x中没有用.

我当前的代码如下所示:

<!DOCTYPE HTML PUBliC "-//W3C//DTD xhtml 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><HTML xmlns="http://www.w3.org/1999/xhtml"><head><Meta http-equiv="Content-type" content="text/HTML;charset=UTF-8" /><link rel="stylesheet" type="text/CSS" media="all" href="CSS/reset.CSS" /><link rel="stylesheet" type="text/CSS" media="all" href="CSS/text.CSS" /><link rel="stylesheet" type="text/CSS" media="all" href="CSS/960.CSS" /><link rel="stylesheet" type="text/CSS" media="all" href="CSS/custom.CSS" /><Title>The system</Title></head><body><div  ID="base">    <div  ID="header">Graphical banner</div>    <div >&nbsp;</div>    <div  ID="logoutrow">logout row</div>    <div >&nbsp;</div>    <div  ID="navigation-content>        <div  ID="navigation">Navigation</div>        <div  ID="content">Content</div>    </div>    <div >&nbsp;</div>    <div  ID="footer">Footer</div>    <div >&nbsp;</div></div></body></HTML>

960 grid system表示网格子节点应遵循一定的规则.第一个子节点应该具有Alpha类,最后一个子节点应该是omega类.这就是我在上面做的.这与GateKiller在下面给出的答案不同,除此之外提供了解决方案.

解决方法 执行此 *** 作的最佳方法是将#navigation和#contents包装在容器div中,如下所示:

<div  ID="base">    <div  ID="header">Graphical banner</div>    <div  ID="logoutrow">logout row</div>    <div  ID="navigation-content">        <div  ID="navigation">Navigation</div>        <div  ID="content">Content</div>    </div>    <div  ID="footer">Footer</div></div>

然后,您可以将背景设置为:

#navigation-content {    background: #000}

如果您不使用完整的16个网格或使用任何需要清除的浮动规则,您只需要清除div. The author has the following to say on the clear:

Lastly,I wanted to talk about the clearing methods included in the 960.CSS. First off is my personal preference,adding an innocuous bit of markup to clear all elements. I have already written about it extensively,so I won’t go over all that again. Basically,add class=”clear” to a <span> or <div> that you want to disappear. The only effect it will have is to clear floats.

The other method is for all you markup purists out there,who don’t want to dirty your HTML. Instead,you can insert markup via your CSS. This technique is well documented already as well. Essentially,add class=”clearfix” to elements to clear what comes after them.

总结

以上是内存溢出为你收集整理的HTML – 使用960网格系统的CSS设计问题全部内容,希望文章能够帮你解决HTML – 使用960网格系统的CSS设计问题所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1058586.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-25
下一篇2022-05-25

发表评论

登录后才能评论

评论列表(0条)

    保存