CSS sets the background image for the image

Source: Internet
Author: User

CSS is very powerful. It provides very powerful functions for element performance and page layout. This mainly lies in our flexible operation, in this regard, rich and valuable tutorials and information are provided. The use of images is actually more at the content layer. According to the concept of the Web standard, the pictures on the presentation layer have been separated into CSS. Only images that serve as content can be inserted to the page using the IMG tag. This is also the semantics that has always been emphasized.

Setting a background image for an image is a very interesting example. This sentence may seem a little fun. We set a background image for the image that is introduced to the page using the IMG label. Such an application may not be very wide, but it can train your thinking and help you understand the meaning and flexibility of elements in HTML and CSS.
Let's take a look at the followingCode.


This is to introduce the image to the page using the IMG label.

Let's write CSS again.

IMG {
Display: block;
Width: 443px;
Height: 60px;
Padding-bottom: 10px;
Background: url(jb52bg.jpg) No-repeat left bottom;
}
Convert the IMG element to a block element and set the width and height. Set the bottom margin to 10px. Reserve a certain amount of space for the displayed background image. Finally, define the background image.
From this small example, we can see that CSS is flexible and powerful.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.