可能重复:
有没有办法声明一个元素的CSS属性,这样它就不会影响它的任何子元素,或者有没有办法声明一个元素的CSS,只实现指定的样式,而不继承为它的父元素声明的任何样式?
一个简单的例子
HTML:
<body>
<div id="container">
<form>
<div class="sub">Content of the paragraph
<div class='content'>Content of the span</div>
我有一个现有的网站与许多旧网页和表格布局,我正试图逐步过渡到CSS。我想使用Twitter Bootstrap样式表--尤其是表单的样式--但只在我明确要求它们的页面部分使用。例如,我可能将整个表单放在一个div中,如下所示:
<div class="bootstrap">
<!-- everything in here should have the Bootstrap CSS applied -->
<form>
<p><label for="text_input">Label</l
我在通过CSS编辑我的单选按钮时遇到了一些问题,因为我不知道如何正确地引用它们。我的代码如下:
<div class="wrapper">
<h1 class="testTitle"> Letter Height</h1>
<h2 class="testIns">Press the buttons to make it shorter or taller!</h2>
<div id="testBox">
<img src="images/