CSS Reference methods

Source: Internet
Author: User

Referencing CSS styles in Web pages
    • inline style
    • Inline style sheet
    • External style sheet
      • LINK Type
      • Import type

Inline mode

styleLabel

<!doctype html>>><metaCharSet="UTF8"><style> P{Color: Red;}</style> > <body> <p> This is a P tag! </p> </body>>         
inline style
<!doctype html>>><metaCharSet="UTF8">><body><p style=" color ; " > This is a P tag! </p > </body>>         
Outreach style Sheets-linked

linkLabel

Index.css

p {  color: green;}

The link tag is then introduced in the HTML file:

<!doctype html>>><metaCharSet="UTF8"><linkRel="Stylesheet"Href="Index.css">  > <body> <p> This is a P tag! </p >  </body>>         
external style sheet [email protected] URL () mode import

Understand.

Index.css

url(other.css)

Attention:
@import url()Must be written at the beginning of the file.

The difference between a link and an import
1、<link/>标签属于XHTML,@import是属性css2.12、使用<link/>链接的css文件先加载到网页当中,再进行编译显示3、使用@import导入的css文件,客户端显示HTML结构,再把CSS文件加载到网页当中4、@import是属于CSS2.1特有的,对于不兼容CSS2.1的浏览器来说就是无效的

CSS Reference methods

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.