男生对女生说:you are the CSS to my HTML.是什么意思

html-css012

男生对女生说:you are the CSS to my HTML.是什么意思,第1张

这CSS是对HTML进行美化和布局的,没有CSS页面根本不会丰富多彩,这句话其实是一对情侣衫的标语:You are the css to my html(我是html,你是css,没有你我的生活不会丰富多彩。),You are the javascript to my html(我是html,你是javascript,你对我的控制与操作,我心甘情愿。)

css的parent样式如何用

directly?)

一般来说,当我们有一些应该一起设置样式的子元素时,我们应该将该样式放到父级并让继承工作,还是给孩子们自己? 例如,如果我们有如下结构:

<div class="foo">

<p>should be 2em</p>

<ul>

<li>should be 2em</li>

<li>should be 2em</li>

</ul>

</div>

然后我应该这样做:

.foo {font-size: 2em}

或类似的东西?:

.foo p, .foo li {font-size: 2em}

我认为这个问题非常基本,但很抱歉我找不到任何好的谷歌搜索结果。

Generally speaking, when we have some child elements that should be styled together, should we put that style to the parent and let the inheritance work, or to the children themselves? For example, if we have a structure as below:

<div class="foo">

<p>should be 2em</p>

<ul>

<li>should be 2em</li>

<li>should be 2em</li>

</ul>

</div>

then should I make it as this:

.foo {font-size: 2em}

or something like this?:

.foo p, .foo li {font-size: 2em}

I think this question is very basic, but sorry I couldn't find any good google result.