Css 类选择器

标签 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>

现在我如何才能仅更改此 div 的 class="c"属性的宽度?

最佳答案

你可以这样做:

.c#i { width:400px }

这会改变类 c 和 id i

的 div 的宽度

关于Css 类选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10794610/

相关文章:

html - 分区 :hover works but moves the div to the right of it

html - 有谁知道如何用 CSS 绘制这些类型的箭头?

jquery 从上到下滚动

javascript - 如何在没有事件或按钮的情况下使图像出现和消失

javascript - 使用新的 CSS 文件覆盖当前网站的

css - 将边框颜色添加到范围旋钮 ionic-range

html - 删除正文和页脚之间不需要的空间

css - 对 custom.css.scss 进行微小更改后 Bootstrap 无法正常工作

html - 使两个具有可变宽度内容的元素具有相同的宽度

javascript - 我如何 'reset' 调用方法?