Learn CSS Use tips tutorial (4) Separate call

Source: Internet
Author: User
css| Skills | tutorials

Previous section: external Call

  Why should we call it alone?

"Call alone" is to add the style attribute. is to apply the CSS declaration to a single page element (any text, picture, table ...). And so on, are page elements), at this point, CSS will no longer be a style sheet to display the results, but use the style attribute added to the label. Why do you want to "call" CSS individually? The reason is: more flexible ... For a simple example, do we want to make the input form's background not white?


  About the Style property

In fact, almost every HTML tag has its own attributes, such as <p align= "center" > where align is the align alignment attribute of label <p>, plus the align attribute, you can set the paragraph to be left, center or right. The same, style can also be regarded as a property, as added to the label, in terms of our above question, its original syntax should be this:

syntax: <input type= "text" value= "Am I light green? "> Results:

Now, we add the style attribute to the input form, which is to add the style attribute to the <input> tag:

syntax: <input type= "Text" value= "I have a light green background this time." style= "Background-color: #ccffcc">

Results:


"Style=" "is the use of STYLE as a property, followed by the same CSS declaration in the" "Inside, as for the inside of the Background-color: #ccffcc意思就是" background color: #ccffcc "meaning, now not familiar with the matter, will continue to explain in the future.

  What tags can be added to the style attribute?

Basically, any label can add a style attribute. So you don't have to worry about tags that won't be accepted. However, a separate call to add a style attribute to a page element is very flexible, but it loses one of the advantages of CSS, and that is uniformity. So, you are using, unless only some of the page elements need to use the CSS format alone, otherwise, as far as possible in the use of the call method described before, so, in the future maintenance will be relatively simple.

Next section: Custom Categories



Related Article

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.