Css类选择器

时间:2012-05-29 07:11:41

标签: css

我想选择class = "c" & id = "i"

的div
 .c
 {
   color: red;
   border:1px;
   font-size:25px;
   background-color: yellow;
   width:200px;
 }

 <div id="i" class="c">change</div>

现在我怎么能只改变class =&#34; c&#34;的宽度?这个div的属性?

3 个答案:

答案 0 :(得分:3)

您可以这样做:

.c#i { width:400px }

这会更改div c和ID i

的宽度

答案 1 :(得分:1)

  

现在我怎样才能改变class =“c”属性的宽度   DIV?

选择课程为c的div:

div.c {width: yourValue;}

更改包含课程c和ID i的div:

.c#i {width: yourValue;}

答案 2 :(得分:1)

嘿,你可以这样做

#i.c{
width:xxx; //your value
}