CSS - 设计类的不同方法 [英] CSS - different approaches of styling a class

查看:100
本文介绍了CSS - 设计类的不同方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

阅读以下CSS代码我想知道,a)和b)之间有什么区别?第一个声明是一个很好的样式吗?

Reading the following CSS code I was wondering, what is the difference between a) and b)? Is the first declaration a good way of styling?

a)

.round_box.icon{

  ....
}

b)

.round_box .icon{

  ....
}


推荐答案

使用A: class(在同一时间)

With A : You select all the elements with the 2 classes (at the same time)

使用B:在所有具有类round_box的元素中选择所有带有class icon的元素

With B : You select all the elements with class icon inside all the elements with class round_box

这篇关于CSS - 设计类的不同方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆