CSS中的点是什么意思? [英] What does the dot mean in CSS?

查看:539
本文介绍了CSS中的点是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以解释这两个CSS选择器的区别吗?

Can someone explain the difference for these two CSS selectors?

.work-container . h3 {
font-size: 14px;
margin-top: 0px;
font-weight: 600;
height: 27px;
} 

上层定义中的额外点是什么?

What is the extra dot in the upper definition?

.work-container h3 {
font-size: 14px;
margin-top: 0px;
font-weight: 600;
height: 27px;
} 


推荐答案

A 前缀通常代表一个类选择器,但如果它紧跟着空格,那么它是一个语法错误。

A . prefix usually represents a class selector, but if it's immediately followed by whitespace then it's a syntax error.

猜猜,那么很可能是作者想说 .work-container> h3 ,但是错过了Shift键,正如他打算输入> 字符(子组合器)。

If I were to hazard a guess, then it's likely the author meant to say .work-container > h3, but missed the Shift key just as he was about to type the > character (the child combinator).

.work-container h3 ,简单地意味着包含在具有类<$ c $的元素中的任何 h3 c> work-container 。

Your second selector, .work-container h3, simply means any h3 that's contained within an element with a class called work-container.

这篇关于CSS中的点是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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