我创建了一个名为 mytheme 的 Zen 子主题,并将 /sites/all/themes/zen/STARTERKIT/css
的内容复制到 /sites/all/themes/mytheme/css/
code>,并将导航块分配给第一个侧边栏区域。
我想知道哪个 CSS 文件控制导航菜单的样式,因此我在网络浏览器 (Google Chrome 7.0.517.44) 中加载了该网站。
导航块包含在 class="region region-sidebar-first column sidebar"
的 div 中。我使用 Firebug 突出显示了此代码,它告诉我该类是在:http://www.mysite.dev/sites/all/themes/mytheme/css/layout-fixed.css
中定义的。
在layout-fixed.css中没有名为regionregion-sidebar-firstcolumnsidebar
的CSS类,但是有一个名为.region-sidebar-first
的类,我认为与“区域区域侧边栏第一列侧边栏”有关。
CSS 类名中哪些字符有效? SO 主题说“名称必须以下划线 (_)、破折号 (-) 或字母 (a–z) 开头,后紧跟 1 个字母或下划线,然后是任意数量的破折号、下划线、字母,或数字”,这是有道理的。
但是 .region-sidebar-first
在 HTML 源代码中如何最终变成 'class="regionregion-sidebar-first column sidebar"'
呢?这对于像我这样的初学者来说很困惑,如果有人能解释这个命名约定背后的逻辑,那就太好了。
I created a Zen sub-theme called mytheme and copied the contents of /sites/all/themes/zen/STARTERKIT/css
to /sites/all/themes/mytheme/css/
, and assigned the Navigation block to the First sidebar region.
I want to know which CSS file controls the styling of the Navigation menu, so I loaded the site in my web browser (Google Chrome 7.0.517.44).
The Navigation block is contained in a div with class="region region-sidebar-first column sidebar"
. I highlighted this code using Firebug, which tells me that the class is defined in: http://www.mysite.dev/sites/all/themes/mytheme/css/layout-fixed.css
.
There isn't a CSS class called region region-sidebar-first column sidebar
in layout-fixed.css, but there is a class called .region-sidebar-first
, which I assume are relates to 'region region-sidebar-first column sidebar'.
What characters are valid in CSS class names? SO topic says "name must start with an underscore (_), a dash (-), or a letter(a–z), followed immediately 1 by a letter or underscore, and then any number of dashes, underscores, letters, or numbers", which makes sense.
But how does .region-sidebar-first
end up as 'class="region region-sidebar-first column sidebar"'
in the HTML source code? This is confusing for beginners like myself, and if anyone can explain the logic behind this naming convention, that would be great.
发布评论
评论(2)
这些是应用于同一元素的多个类。您可以用空格分隔多个类。因此,从技术上讲,那里应用了四个类。
Those are multiple classes applied to the same element. You separate multiple classes with a space. So, technically, there are four classes applied there.
您可以为一个元素指定多个类,并用空格分隔。您的元素总共有四个类:region、region-sidebar-first、column 和 sidebar。
You can give an element several classes, seperated with spaces. Your element has four classes in total: region, region-sidebar-first, column and sidebar.