Use CSS Selectors Cleverly_Experience Exchange

WBOY
Release: 2016-05-16 12:05:40
Original
1417 people have browsed it

Link styles in different content blocks can be defined through different rules. Something like this: #nav a:link or #main a:link or #footer a:link. You can also define different styles for the same elements in different content blocks. For example, define the styles of #main p and #sider p respectively through #main p and #sider p. Structurally speaking, your page is composed of pictures, links, lists, paragraphs, etc. These elements themselves do not affect which network device they are displayed on (PDA, mobile phone or Internet TV). They can be defined as Any performance appearance.

A carefully structured HTML page is very simple, and every element is used for structural purposes. When you want to indent a paragraph, you don't need to use the blockquote tag. Just use the p tag and add a CSS text-indent rule to p to achieve the indentation purpose. p is a structured tag and text-indent is a presentation attribute. The former belongs to HTML and the latter belongs to CSS. (This is the legendary separation of structure and performance)

There are almost no performance attribute tags in a well-structured HTML page. The code is very clean and concise. For example, the original code

can now just write
in HTML, all things that control the presentation All are written in CSS. In structured HTML, table is a table, not anything else (it cannot be used for layout and positioning).

Of course, CSS selectors are not just that simple. In addition to id and class, there are also descendant selectors, attribute selectors, etc.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!