The gap between the div layer is also the gap between the img and the div.

Source: Internet
Author: User

One problem today is that there is a blank gap between the upper and lower layers (the picture is placed in the layer)

Solution: locate the image code in the above div and set the attribute style = "display: block" for it. solution.

Or there is a div (with images) under img to set img (the object above the div) and its set attribute style = "display: block". The problem is OK.

Display: block indicates that the object is a block-level element (such as a and span ).

General Block-level elements such as paragraph <p>, title Table <uL> <ol> <dl>
, Table <table>, form <form>, DIV <div>, and BODY <body>. While inline Elements
For example, <input>, hyperlink <a>, image , and <span> ........

A notable feature of block-level element-free is that each block-level element is displayed from a new line, and the subsequent element-level element must be displayed in another line.

The text in the CSS authoritative guide shows that any visible element that is not a block-level element is an inline element. Its performance is"
Row layout, which means that the row layout is always displayed as a row. For example, we set an inline element border-bottom: 1px solid
#000; it indicates that each line is repeated, and there is a black fine line under each line. If it is a block-level element, the displayed black line will only appear below the block.

For example, the following code shows the differences between the inline element img and the block-level element div:

Html code Src = "a.jpg" style = "border-bottom: 1px solid #000 ;" /> Src = "a.jpg" style = "border-bottom: 1px solid #000; display: block" /> <P> </p> Src = "a.jpg" style = "border-bottom: 1px solid #000; display: block" /> Src = "a.jpg" style = "border-bottom: 1px solid #000 ;" />

The effects of the above Code are as follows:

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.