类ID语法 [英] Class an ID syntax

查看:80
本文介绍了类ID语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的


我现在知道如果元素重复,我会使用一个类。我可以使用ID,如果

它们是唯一的。


我现在有问题。


随着ID一切都很好,但没有验证。所以我必须重写

代码......但是怎么样?我对所有的。感到困惑。和#。什么是

正确的语法(如果有的话)?


Mark


< part code>

#info {

宽度:320px;

填充:0;

保证金:0;

float:right;

}


#info .omschrijving {

保证金:0;

填充:0px 30px 20px 10px;

宽度:270px;

字体大小:75%;

}


#info h2 {

保证金:0;

填充:0 0 10px 0px;

宽度:320px ;

}

< / part code>

------------------ ------------------------

< part code html>

< div id =" info">

< h2>项目1< / h2>

< p class =" omschrijving"> bla bla< / p>

< / div>

< div id =" info">

< h2> Item 2< / h2>

< p class =" omschrijving"> bla bla< / p>

< / div>

< / par t code html>


---------------------------------- ---------

--------------------------------- ----------

这不起作用:


<部分新代码html>

< div class =" info">

< h2> Item 1< / h2>

< p class =" omschrijving"> bla bla< ; / p>

< / div>

< div class =" info">

< h2> Item 2< ; / h2>

< p class =" omschrijving"> bla bla< / p>

< / div>

< / part new code html>


------------------------------ ------------

< new css>


..info {

}


..info .omschrijving {


}


..info h2 {


}


< / new css>

Ok

i know now that i use a class if elements repeat. And i can use an ID if
they are unique.

I now have a problem.

With ID all is well, but does not validate. So i have to rewrite the
code... but how? I am confused with all the "." and "#". What is the
correct syntax (if any?)

Mark

<part code>
#info {
width:320px;
padding:0;
margin:0;
float:right;
}

#info .omschrijving {
margin:0;
padding:0px 30px 20px 10px;
width:270px;
font-size:75%;
}

#info h2 {
margin:0;
padding:0 0 10px 0px;
width:320px;
}
</part code>
------------------------------------------
<part code html>
<div id="info">
<h2>Item 1</h2>
<p class="omschrijving">bla bla</p>
</div>
<div id="info">
<h2>Item 2</h2>
<p class="omschrijving">bla bla</p>
</div>
</part code html>

-------------------------------------------
-------------------------------------------
This does not work:

<part new code html>
<div class="info">
<h2>Item 1</h2>
<p class="omschrijving">bla bla</p>
</div>
<div class="info">
<h2>Item 2</h2>
<p class="omschrijving">bla bla</p>
</div>
</part new code html>

------------------------------------------
<new css>

..info {
}

..info .omschrijving {

}

..info h2 {

}

</new css>

推荐答案

Mark写道:
Mark wrote:
Ok
我现在知道如果元素重复,我会使用一个类。我可以使用ID,如果它们是唯一的。

我现在有一个问题。

使用ID一切都很好,但不验证。所以我必须重写
代码......但是怎么样?我对所有的。感到困惑。和#。什么是正确的语法(如果有的话)?

[snip]

----------------- --------------------------
这不起作用:

<部分新代码html>
< div class =" info">
< h2> Item 1< / h2>
< p class =" omschrijving"> bla bla< / p>
< / div>
< div class =" info">
< h2> Item 2< / h2>
< p class =" omschrijving" ;> bla bla< / p>
< / div>
< /部分新代码html>

------------ ------------------------------
< new css>

.info {
}

.info .omschrijving {

}

.info h2 {

}

< / new css>
Ok

i know now that i use a class if elements repeat. And i can use an ID if
they are unique.

I now have a problem.

With ID all is well, but does not validate. So i have to rewrite the
code... but how? I am confused with all the "." and "#". What is the
correct syntax (if any?)

[snip]

-------------------------------------------
This does not work:

<part new code html>
<div class="info">
<h2>Item 1</h2>
<p class="omschrijving">bla bla</p>
</div>
<div class="info">
<h2>Item 2</h2>
<p class="omschrijving">bla bla</p>
</div>
</part new code html>

------------------------------------------
<new css>

.info {
}

.info .omschrijving {

}

.info h2 {

}

</new css>




看起来对我不对。你能不能把这个URL写成一份完整的文件,也许

问题就在其他地方烧了。


-

Benjamin Niemann

电子邮件:粉红色at odahoda dot de

WWW: http://www.odahoda.de/


Benjamin Niemann写道:
Benjamin Niemann wrote:
Mark写道:

Mark wrote:

确定

我现在知道如果元素重复,我会使用一个类。我可以使用ID,如果它们是唯一的。

我现在有一个问题。

使用ID一切都很好,但不验证。所以我必须重写
代码......但是怎么样?我对所有的。感到困惑。和#。什么是正确的语法(如果有的话)?

[snip]

----------------- --------------------------
这不起作用:

<部分新代码html>
< div class =" info">
< h2> Item 1< / h2>
< p class =" omschrijving"> bla bla< / p>
< / div>
< div class =" info">
< h2> Item 2< / h2>
< p class =" omschrijving" ;> bla bla< / p>
< / div>
< /部分新代码html>

------------ ------------------------------
< new css>

.info {
}

.info .omschrijving {

}

.info h2 {

}

< / new css>
Ok

i know now that i use a class if elements repeat. And i can use an ID if
they are unique.

I now have a problem.

With ID all is well, but does not validate. So i have to rewrite the
code... but how? I am confused with all the "." and "#". What is the
correct syntax (if any?)

[snip]

-------------------------------------------
This does not work:

<part new code html>
<div class="info">
<h2>Item 1</h2>
<p class="omschrijving">bla bla</p>
</div>
<div class="info">
<h2>Item 2</h2>
<p class="omschrijving">bla bla</p>
</div>
</part new code html>

------------------------------------------
<new css>

.info {
}

.info .omschrijving {

}

.info h2 {

}

</new css>



看起来对我不对。你能否把URL提供给一个完整的文件,也许
问题是埋在其他地方。


Looks correct to me. Can you give the URL to a complete document, perhaps
the problem is burries somewhere else.




好​​吧,我认为还有别的问题,所以这里是URL:


红色背景不会停留,但有点帮助。文本

必须在这个区域内。


对于绿色区域:这里必须是标题(< h2>)

http://www.keyone.nl/ lab / beeldlijn / nl / collection.asp

我希望你能帮助我!

谢谢

Mark



Ok, i think there is something else wrong, so here is the URL:

The red background is not going to stay, but a little help. The text
has to be in this arrea.

For the green arrea: here has to be the title (<h2>)

http://www.keyone.nl/lab/beeldlijn/nl/collection.asp

I hope you can help me out!
Thanks
Mark


< snip>


我确实解决了它:0)

因为div中的类(#dvd),我必须扩展我的定义。


所以,而不是


..winkelwagen


#dvd .winkelwagen




马克

<snip>

I did solve it :0)

Because the classes where in a div (#dvd), i had to extend my definitions.

So, instead of

..winkelwagen

#dvd .winkelwagen

etc.

Mark


这篇关于类ID语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆