html中变量前的点表示什么?
总的来说,我对 html 和 web 编码很陌生。下面的代码中变量前面的句点表示什么?
<style>
<!-- Modify these styles -->
.page_title {font-weight:bold}
.page_text {color:#000000}
</style>
... JS code
谢谢
I'm new to html and web coding in general. What do the periods before variables indicate in the following code?
<style>
<!-- Modify these styles -->
.page_title {font-weight:bold}
.page_text {color:#000000}
</style>
... JS code
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这些不是变量。
这些是 CSS 选择器,它们代表每个示例中具有该类的 HTML 节点。
您可以使用 CSS 选择器来设置 HTML 中这些元素的样式,
因为他们已经建议了。 =)
有几种方法可以在 CSS 中引用 HTML 节点,最常见的是 ID、类和标签名称。
看看这个例子
好吧。我们有一个带有两个无序列表的 div,每个列表作为两个列表项,现在 CSS:
div
选择器将选择 HTML 中的所有页,
# 表示 ID,因此
#first_set
它将选择具有该 id 的对象,在本例中它将选择点符号选择类,因此
.item
选择器将选择所有对象在这种情况下,使用 item 类,它将选择所有这实际上只是基础知识,您可以混合这些选择器,使每个示例更加具体:
并且它只会选择 #first_set 内具有 item 类的对象。
those are not variables.
Those are CSS Selectors, and they represent a HTML node with that class per example
You use CSS Selectors to style those elements in the HTML
Since they've suggested. =)
There are a few ways to reference HTML nodes in CSS, the most common are ID's, Classes and the tag name.
take a look at this example
Ok. we have a div with two unordered lists, each list as two list-items, now the CSS:
the
div
selector will select all<div>
's in the HTML page,the # means ID, so
#first_set
it will select the object with that id in this case it will selectthe dot symbol select classes so the
.item
selector will select all objects with the item class in this case it will select allThis is just the basics really, you can mix these selectors to be more specific per example:
and it will only select the objects with class item that are inside the #first_set.
也就是在CSS中将一个样式分组标记为一个类。
请阅读教程@w3schools,这是一个非常好的入门教程。
http://www.w3schools.com/css/default.asp
That is to mark a style grouping as a class in CSS.
Please go through the tutorial @w3schools, that is a real good starter.
http://www.w3schools.com/css/default.asp
通常某些东西所属的类,例如
treelistcontainer是类,输入是类中的控件,因此样式仅影响该类中的控件
usually the class something belongs to for example
treelistcontainer is the class and input is the control within the class so the style only affects the controls within that class
你所说的部分是嵌入在HTML中的CSS。 CSS 和 HTML 都没有变量,您正在查看选择器。
点前缀表示它是一个 类选择器 并且将匹配一个 HTML 元素,它是给定类的成员。
要使元素成为类的成员,类名将添加到以 类属性。
因此
.page_title
将与以下元素匹配:但是,一般来说,您赋予类名(例如“page_title”)的任何内容都可能与主标题相同,因此 HTML 通常应该看起来像:
而 CSS:
顺便说一句,
是 HTML(和 HTML 兼容的 XHTML)中的错误。 CSS 注释由
/*
和*/
分隔。The section you talk about is CSS embedded in HTML. Neither CSS nor HTML have variables, you are looking at selectors.
The dot prefix indicates that it is a class selector and will match an HTML element which is a member of the given class.
To make an element a member of a class, the class name is added to the space separated list given as the value of the class attribute.
Thus
.page_title
will match an element with:Generally speaking, however, anything you give a class name such as "page_title" to is likely to be the same thing as the main heading, so the HTML should usually look like:
And the CSS:
Incidentally,
<!-- Modify these styles -->
, is an error in HTML (and HTML compatible XHTML). A CSS comment is delimited with/*
and*/
.