I have a div element that has an id and this div contains a set of inputs and labels. I ONLY want to style the inputs inside this specific div but .. the following styles everything (global) instead of keeping the scope inside #ParentDiv
我有一个具有id的div元素,这个div包含一组输入和标签。我只想在这个特定div中设置输入样式但是......以下样式一切(全局)而不是将范围保持在#ParentDiv中
#ParentDiv label,input { display: inline; }
Also, is it possible to do this type of thing with valid css in IE6/7?
另外,有可能在IE6 / 7中使用有效的css做这种类型的事情吗?
1 个解决方案
#1
67
you need this:
你需要这个:
#ParentDiv label, #ParentDiv input { display: inline; }
A comma indicates a new selector statement.
逗号表示新的选择器语句。
Often, so that I remember what each of the selectors is, and to make it easier to see what elements are being selected at a glance, I will alphabetize and break the selectors on two separate lines like so:
通常,为了让我记住每个选择器的内容,并且为了更容易看到哪些元素一目了然,我将按字母顺序排列并在两条不同的行上打破选择器,如下所示:
#ParentDiv input,
#ParentDiv label {
display: inline;
}
Also, this should work just fine in IE 6/7/8, and is valid according to w3c.
此外,这应该在IE 6/7/8中正常工作,并且根据w3c有效。
#1
67
you need this:
你需要这个:
#ParentDiv label, #ParentDiv input { display: inline; }
A comma indicates a new selector statement.
逗号表示新的选择器语句。
Often, so that I remember what each of the selectors is, and to make it easier to see what elements are being selected at a glance, I will alphabetize and break the selectors on two separate lines like so:
通常,为了让我记住每个选择器的内容,并且为了更容易看到哪些元素一目了然,我将按字母顺序排列并在两条不同的行上打破选择器,如下所示:
#ParentDiv input,
#ParentDiv label {
display: inline;
}
Also, this should work just fine in IE 6/7/8, and is valid according to w3c.
此外,这应该在IE 6/7/8中正常工作,并且根据w3c有效。