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 for html

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the knowledge of "how to set the background for html". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Html setting background method: 1, use the bgcolor attribute of the body tag to set the background color; 2, use the background attribute of the body tag to set the background picture; 3, use the style attribute in the body tag to add "background: color value / url ('picture path')".

The operating environment of this tutorial: windows7 system, CSS3&&HTML5 version, Dell G3 computer.

Html sets the background

1. The bgcolor attribute of the body tag

The bgcolor property specifies the background color of the document.

Hello world!

Effect picture:

Note: if you use a color name, different browsers will have different rendering structures, and if you use RGB code, Firefox will not be able to display the correct color.

Tip: if all browsers want to display the same color, use a hexadecimal color code.

2. The background attribute of the body tag

The background attribute specifies the background image of the document.

Effect picture:

3. Css background attribute

The background property is an abbreviated property that sets all the background properties in a declaration.

The properties that can be set are:

Background-color

Background-position

Background-size

Background-repeat

Background-origin

Background-clip

Background-attachment

Background-image

Example:

Body {background: pink url ('smiley.gif') no-repeat fixed center;}

This is some text

This is some text

This is some text

This is some text

This is some text

This is some text

This is some text

This is some text

This is some text

This is some text

This is some text

This is some text

This is some text

This is some text

This is some text

This is some text

Effect picture:

This is the end of "how to set the background for html". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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: 253

*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

Internet Technology

Wechat

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

12
Report