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

An example Analysis of html setting Picture location

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

Today, the editor will share with you the relevant knowledge points of html setting picture location example analysis, the content is detailed, the logic is clear, I believe most people still know too much about this knowledge, so share this article for your reference, I hope you can get something after reading this article, let's take a look at it.

Html sets the location of the picture by adding the background-positon property to the picture and setting the appropriate property value, such as [background-position:center;].

This article operating environment: windows10 system, html 5, thinkpad T480 computer.

To set the location of the background image, you can use the background-position property provided to us by css.

The bakcground-positon property is used to set the starting position of the background image. Its common property values are:

The first value of x% y% is horizontal and the second value is vertical. The upper left corner is 0% 0%. The lower right corner is 100% 100%. If only one value is specified, the other values will be 50%. . Default value: 0% 0%

The first value of xpos ypos is horizontal, and the second value is vertical. The upper left corner is 0. The units can be pixels (0px0px) or any other CSS unit. If only one value is specified, the other values will be 50%. You can mix% with positions.

Inherit specifies that the background-position property setting should inherit from the parent element

Code example:

(php.cn) body {background-image:url ('smiley.gif'); background-repeat:no-repeat; background-attachment:fixed; background-position:center;}

Note: this property works on Firefox and Opera, and the background-attachment property will be set to "fixed".

These are all the contents of the article "html setting Picture location example Analysis". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to 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

Internet Technology

Wechat

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

12
Report