Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set background property in CSS

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to set background properties in CSS". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to set background properties in CSS".

The main background-related attributes are:

Background-color background Color

Background-image background picture

Whether background-repeat tiles repeat (default tile) | repeat-x (horizontal tile) | repeat-y (vertical tile) | no-repeat (no tile)

Background-position background position length (percentage) | position (topcenterbuttonleftright) is generally used together. If one direction is specified and the other direction defaults to center, the two methods can also be mixed up. Orientation nouns are not sequentially distinguished, but percentages are used sequentially all the time, first horizontally and then vertically.

Background-attachment background fixed or scrolling scroll | fixed

Background: whether the background color background picture is tiled, the background is fixed or the scrolling background position

# p1 {

Width:300px

Height:300px

Background-color:blue;/* defaults to transparent transparent * /

/ * background-color:transparent;*/

Background-image:url (Images/2.jpg)

Background-repeat:no-repeat;/* is not tiled. The default is horizontal and vertical tiling * /

/ * background-repeat:repeat-y;*/

/ * background-repeat:repeat-x;*/

/ * background-position:rightbottom;*/

Background-position:10%center

Background-attachment:fixed

}

If you want the background to be translucent and use rgba when specifying a color, an indicates transparency.

P {

Width:100%

Height:300px

Background-color:rgba (0. 0. 0. 6)

}

Use background to specify multiple url when you want to use multiple background images. Each group is separated by a', 'comma. If there is an overlap, the previous one overrides the last one, but the overall background color must be specified after the last url.

P {

Width:100%

Height:300px

Background:url (Images/2.jpg) no-repeatlefttop,url (Images/3.jpg) no-repeatrightbottomblue

}

The above is all the content of the article "how to set background properties in CSS". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report