如何从div语句中排除标记

时间:2012-10-13 21:21:33

标签: html tags

我正在尝试制作一个包含除<p>标签之外的所有内容的div标签。有没有办法排除某些或某些标签?谢谢你的帮助。

我的代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<head>
<link rel="stylesheet" type="text/css" href="styles.css" />

<body>

<div id='main'>

<h1>FREE Python programs!</h1>

<h3><p>You're saying to yourself "I could use a handy little program that does this
" or "I need a better calculator than Windows has provided me!" THIS IS THE SITE YOU'VE      BEEN LOOKING FOR! Just email me at:</p></h3> 

<a href="mailto:benevedeselias@gmail.com" target="_blank">Python Program Maker</a>

<h3><p>And I'll respond as fast as I can!</p></h3>
<p>This is my portfolio of very small applications:</p>

<a href="portfolio.zip">Portfolio Download</a>

<p>If you would like to subscribe to my Python Mailing list, click on the link above to    shoot me an email. Please have the subject be "Add to mailing list". All this mailing list    would do is send you updates to my website, python programs, or portfolio. This would mean   a great lot to me if you did.</p>

<p>These links provide more information about each piece in my portfolio:</p>

<a href='CardDrawer.html'>Card Drawer</a>
<a href='BlockGame.html'>Block Game</a>
<a href='Dice.html'>Dice</a>
<a href='SecretNumber.html'>Secret Number</a>

<p>If you would like to learn python yourself, I have started a video tutorial series.     Here is the first one:</p>
<iframe width="560" height="315" src="http://www.youtube.com/embed/STe5x9V8kbk?rel=0"    frameborder="0" allowfullscreen></iframe>

</div>



</body>

</head>

我试图做的就是避免在每个p标签上打破多个div标签并在它之后重新开始。

2 个答案:

答案 0 :(得分:0)

为什么你不想让p标签周围的div?

使用一个包含p标签的div标签,您应该能够在CSS中设置所有内容

答案 1 :(得分:0)

我真的不明白你的意思,但我可以尝试:

您可以为<p>代码提供自己的课程和/或ID。你可以在你的CSS中为它创建一个class / id,这样他们就会忽略给你div的css。 (我希望这就是你的意思)

所以你得到:

<p class="yourclass">text</p>

你甚至可以给他们不同的背景颜色。如果您不想将它们放在div中,只需将它们放在它之外即可。虽然没有太大的好处......

如果你的意思是想要每个人都结束div,那就是你必须要做的事情。没办法。