CSS Practical Example (recommended) _css/html

Source: Internet
Author: User
Background Background Setting background color
<ptml> <pead> <style type= "Text/css" > body {background-color:yellow} h1 {background-color: #00ff00 } h2 {Background-color:transparent} p {Background-color:rgb (250,0,255)} </style> </pead> <body> <p>this is header 1</p> <p>this are header 2</p> <p>this is a paragraph</p> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Set a picture as background
<ptml> <pead> <style type= "Text/css" > Body {background-image:url (' yun_qi_img/bgdesert.jpg ')} </style> </pead> <body> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Repeat background picture vertically
<ptml> <pead> <style type= "Text/css" > Body {background-image:url (' yun_qi_img/bgdesert.jpg '); Background-repeat:repeat} </style> </pead> <body> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Horizontal Repeat background picture
<ptml> <pead> <style type= "Text/css" > Body {background-image:url (' yun_qi_img/bgdesert.jpg '); Background-repeat:repeat-x} </style> </pead> <body> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

How to place a background picture (position)
<ptml> <pead> <style type= "Text/css" > Body {background-image:url (' yun_qi_img/bgdesert.jpg '); Background-repeat:no-repeat; Background-position:center; } </style> </pead> <body> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Background does not scroll
<ptml> <pead> <style type= "Text/css" > Body {background-image:url (' yun_qi_img/smiley.gif '); Background-repeat:no-repeat; background-attachment:fixed} </style> </pead> <body> <p>the image won't scroll with t He rest of the page</p> <p>the image won't scroll with the rest of the page</p> <p>the image Won't is scroll with the rest of the page</p> <p>the image would not scroll with the rest of the Page</p&gt ; <p>the image won't scroll with the rest of the page</p> <p>the image won't be scroll with the rest o f the page</p> <p>the image won't scroll with the rest of the page</p> <p>the image won't Scroll with the rest of the page</p> <p>the image would not scroll with the rest of the page</p> <p& Gt The image would not be scroll with the rest of the page</p> <p>the image would not be scroll with the REST of the page</p> <p>the image won't scroll with the rest of the page</p> <p>the image would Not scroll with the rest of the page</p> <p>the image would not scroll with the rest of the page</p> & Lt;p>the image won't scroll with the rest of the page</p> <p>the image won't be scroll with the rest of The page</p> <p>the image won't scroll with the rest of the page</p> <p>the image would not s Croll with the rest of the page</p> <p>the image would not scroll with the rest of the page</p> &LT;P&G T The image won't be scroll with the rest of the page</p> <p>the image would not scroll with the rest of the Pag E</p> <p>the image won't scroll with the rest of the page</p> <p>the image would not scroll WI Th the rest of the page</p> <p>the image won't scroll with the rest of the page</p> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

The Background property is resolved by one line (defining the Background property with one line of text)
<ptml> <pead> <style type= "Text/css" > body {background: #00ff00 url (' yun_qi_img/smiley.gif ') no- Repeat fixed Center; } </style> </pead> <body> <p>this is some text</p> <p>this is some text</p&gt ; <p>this is some text</p> <p>this are some text</p> <p>this is some text</p> <p&gt ; This is some text</p> <p>this is some text</p> <p>this are some text</p> <p>this is Some text</p> <p>this is some text</p> <p>this are some text</p> <p>this is some Tex T</p> <p>this is some text</p> <p>this are some text</p> <p>this is some text</p& Gt <p>this is some text</p> <p>this are some text</p> <p>this is some text</p> <p&gt ; This is some text</p> <p>this are some text</p> <p>this is some text</p>; This is some text</p> <p>this are some text</p> <p>this is some text</p> </body> & Lt;/html>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
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.