Home > Web Front-end > CSS Tutorial > You can set a background image for the img element_Experience exchange

You can set a background image for the img element_Experience exchange

WBOY
Release: 2016-05-16 12:04:00
Original
2218 people have browsed it

The implementation method is very simple: set the img element as a block element (display:block;) and assign a padding value.


[Ctrl A Select all Note:If you need to introduce external Js, you need to refresh to execute]

Copy code The code is as follows:

img {
display:block; b
ackground:url('parallax.gif') no-repeat bottom left; padding:93px 100px 75px 100px;}

According to the above principle, by analogy, through a similar method, we can also set bilateral sides for the img element:
Copy code The code is as follows:

img {
display:block;
padding:1px;
background :red;
border:1px solid black;
}
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template