CSS beginners: separate style calls

Source: Internet
Author: User

Why is it called separately?

"Individually called" means adding the STYLE attribute. The CSS declaration is applied to a separate webpage element (any text, image, table... in this case, CSS will no longer display the results in a STYLE sheet, but will use the STYLE attribute to add to the label. Why do we need to "independently call" CSS? The reason is: it is more flexible... for a simple example, we want to make the background color of the input form not white?


About Style attributes

In fact, almost every HTML tag has its own attributes. For example, <p align = "center"> where align is the align attribute of the tag <p> 」, after adding the align attribute, you can set the section to be left, center, or right. The same STYLE can also be regarded as an attribute. The same is added to the tag. For the above problem, the original syntax should be as follows:

Syntax: <input type = "text" value = "is it light green? "> Result:


Now, add the STYLE attribute to the input form, that is, add the STYLE attribute to the <input> label:

Syntax: <input type = "Text" value = "I have a light green background this time"STYLE = "background-color: # ccffcc">

Result:


"STYLE =" ***** "is to use STYLE as an attribute, and then place the CSS declaration in" ". As for the background-color: # ccffcc indicates "background color: # ccffcc". It doesn't matter if you are not familiar with it. We will continue to explain it later.

Can all labels be added with the STYLE attribute?

Basically, the STYLE attribute can be added to any label. Therefore, you don't have to worry about accepting tags. However, although it is flexible to add STYLE attributes to webpage elements by calling them separately, it loses one of the advantages of CSS, that is, uniformity. Therefore, unless only some web page elements need to use the CSS format separately, you should try to use the call method described earlier, so that it will be easier to maintain in the future.

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.