Visual semantics in HTML and CSS

Source: Internet
Author: User

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

  

A stack of sites between you and the user (simplified version)

On the last day of the TXJS conference, a developer asked me:

Object-oriented CSS does not leave you with a lot of performance based class names?

Each layer in the network stack has its own structure. You don't expect the database schema to be used to build PHP middleware, and people expect HTML and CSS to be the same. HTML needs to be written in a meaningful way that represents data or content, which is what I call code semantics. Code semantics in HTML are extremely important for portability and ease of use. On the other hand, CSS is really a separate layer on the stack, and it needs its own architecture that reflects the visual semantics of the page.

Visual semantics describes all the patterns of repetition in a page design. They depict the basic components of your site. In fact, they often only need a little modification to make it easy to implement across-site applications. Visual semantics are not necessarily tied to HTML semantics, because you need a schema that meets the specific needs of each stack.

To peel a template structure from a style

Similarly, many PHP developers want to match CSS and HTML schemas to PHP. Perhaps it would be more challenging to try to apply one of the most familiar layers of abstraction to them? I am ashamed of it. When I was on Facebook, I wanted the PHP layer to match the CSS layer. Luckily, Facebook has a few smart developers who have reined in and helped me improve my understanding.

Hard to put CSS and HTML into PHP can prevent the code is too boring (DRY) and eventually lead to a bloated code, because the CSS and HTML needs than PHP more detailed object structure. In fact, PHP templates are not inherently appropriate because each template contains a number of different HTML and a combination of CSS objects in different ways.

Visual semantics!= class based on performance

It is important to note that I am not suggesting a class name like "Giantblueheading". Class names need to represent the object structure you want to define, not the name of a particular visual class. For example, I often choose to remember the more abstract class name, such as "media" is easy to remember. Media blocks are combined by a fixed-width picture or flash and some text or other content.

  

Media blocks can be used in many different situations, such as combining an icon and a link or profile picture and user name. Specific use cases are separated from the object structure. HTML can be viewed as an instance of a CSS object.

The code for the media block, and many other basic objects, can be found in the OOCSS Open source project.

PS: If you are not familiar with OOCSS, you can read the Oocss FAQ and 99CSS Chinese translation of the FAQ

Visual semantics in HTML and CSS

Original Author: Nicole Sullivan

Visual semantics in HTML and CSS

Please respect the copyright, reproduced please indicate the source, thank you!

Original address: http://www.qianduan.net/visual-semantic-in-html-and-css.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.