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 the background color technology of web page by CSS

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article is about how CSS sets the background color of a web page. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

First, the monochrome setting of the web page

If you have a pure color web background, you only need to set up equipment for body and install bac kg round background color collection.

Body {background:#FFF}

Configure the web page to have a pure white background

Second, regular backing pictures

1. The horizontal approximate background of abrupt change from top to bottom

Screenshot of full screen backing effect of gradual change from top to bottom width

The backup of this kind of web page only needs to cut out a 1-pixel wide, highly matched picture as background material, as shown below:

Cut out what a vertical bar picture material as backing material

Body {background:#FFF url (bg.gif) repeat-x 0}

How to set up the equipment this picture is set up by the water and oil shop at the top of the web page, and the setting is snow-white. Here pay attention to follow your picture path to set up the equipment to introduce the picture ladder.

2. The standard tiling scene picture is compared to the 2014 version of CSS5 web page, which is mutually exclusive with gradual tiling. It is also completed by tiling as a Body backing after cutting out a vertical bar, so that the full-screen web page backup is covered.

What a screenshot of the vertical bar score cut out by css

The code is similar to the first, but the picture is different. Set up the body equipment to back up the picture level tile.

Third, if you are unscrupulous, you will have a big picture background.

Often see some special topics or avatar web pages, the mountain is a very large picture as the background, and in general wide-screen and narrow-screen display can display full-screen full-screen picture, just as the picture can adapt to the different width. Sure, this kind of realization is also very easy, the width of this picture is very easy to control, for example, the width of the widest exposure screen on the market is 2560 pixels, so that this wide-screen display can also cover the full screen, then your backup picture must be made with a width greater than or equal to the width of the 2560px, so that both wide-screen and narrow-screen displays open this web page to cover the full screen. Minimize, maximize, change the predator window opens the background image is full-screen center, looks like a set picture adaptive size.

Key: full-screen adaptive background picture hub is the picture to do to enrich the width, with the widest rate of emergence of the screen can be covered, small discrimination rate is naturally full. At the same time, it is important to configure such a backup picture as the body back-up center.

If this background picture is: bg.jpg configure CSS code:

Body {background: url (bg.jpg) no-repeat center 0}

Code expression: set up equipment and furnishings this picture is the backer of the web page, as usual (no-repeat), the degree is in the middle, it appears on the top.

Fourth, the head backer picture and the bottom matching picture mode how much height can increase or decrease the background shaking at the bottom of the head

Here CSS5 introduces two common differences between the head and the bottom in order to set the door diameter of the equipment structure.

1. Head and copyright images: directly configure the head backing image as body backup in the middle and top, and set the width of the DIV at the bottom copyright to 100%; at the same time, configure this background image or backing color.

Body {background: url (bg.jpg) no-repeat center 0}

# footer {margin:0 auto;width:100%;background: url (ft-bg.jpg) no-repeat center 0}

This completes the scene difference at the bottom of the head without being affected by many heights of the mode.

2. The web page relies on the top setting map and the fixed bottom backing image, while the bottom background picture far exceeds the height of the copyright bottom box.

The pictures of the top and bottom backers of the web page are different, and the mode area goes beyond the screenshots of the top and bottom of the set.

How different the structure of the picture, not with the increase of content at both ends to reduce the impact on the background layout, as usual on the html tag and body configuration backing can be achieved.

If the top dark blue backer picture is "top.jpg" and the bottom light blue background picture is "foot.jpg"

DIV CSS configure web page set key CSS code:

Html {background: url (top.jpg) no-repeat center 0}

Body {background: url (foot.jpg) no-repeat center bottom}

Explanation: set the dark blue background picture to the top of the html backing degree, and set the equipment to set up the light blue background picture for the body backup picture level.

Thank you for reading! This is the end of this article on "how to set the background color technology for CSS". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

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