Vertical-align: the middle is centered. The line feed problem occurs in Firefox,

Source: Internet
Author: User

Vertical-align: the middle is centered. The line feed problem occurs in Firefox,
1. Understanding of vertical-align: middle

Previously, vertical-aign was widely used. In particular, the center alignment problem is often solved by using margin, padding, and so on. Recently, vertical center is often used in projects, so it is necessary to go back and summarize it.

Vertical-aign mainly uses the vertical alignment problem between the text and adjacent elements of the text, and is an inline element, that is, inline or inline-block,

If the element uses float or position: absolute, the vertical-align attribute is invalid.

  

 

In this case, to align the image and text horizontally in the div, you can use the vertical-align: middle style for the img (instead of the text Tab !!! It is not a div tag containing img !)

(In chrome, the preview box is not aligned with the selection button, and ff is automatically aligned ).

Of course, vertical-align: middle style is also available for horizontal alignment between the image preview box and the selection button in the table.

 

2. line feed in FF list

The result of the list is as follows: <dd> float: left is used. When the number of failed numbers is small, the list can be displayed in one row, as shown below:

When there are many failed serial numbers, the list is shown below, which is out of the window range.

 

Solution:

1. In chrome, use word-break: break-all directly for <strong> (word-wrap: break-word; is invalid)

 

2. In Firefox, besides word-break: break-all, display: inline-table; (or display: inline-flex; or inline-block) is added)

Note: If the display attribute serial number is added to chrome, the line feed will be displayed.

 

 

Note: When <dd> float: left; is not used, you can directly use <strong> word-wrap: break-word;, which is valid in both chorme and ff.

 

 

 

 

Thousands of miles away

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.