- <p style="background-color:yellow;">This text has a background color applied.</p>
This results in:
This text has a background color applied.
CSS Background Image
- <p style="height:100px;background-image:url(/pix/smile.gif);">This text has a background image applied. </p>
CSS Background Repeat
- <p style="height:100px;background-image:url(/pix/smile.gif);background-repeat:no-repeat;">This background image does not repeat. </p>
CSS Background Position
- <p style="height:100px;background-image:url(/pix/smile.gif);background-repeat:no-repeat;background-position:100px;">This background image is positioned 100 pixels in from the left. </p>
CSS Background AttachmentDetermines whether or not the background image scrolls with the outer container.
- <p style="height:100px;width:150px;overflow:scroll;background-image:url(/pix/smile.gif);background-attachment:fixed;">This background image is fixed - it doesn't scroll with its outer container. This example uses the CSS overflow property to force the box to scroll when there's too much text to fit in the box. </p>
阅读(328) | 评论(0) | 转发(0) |