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

How to realize the vertical centering of the title of div in CSS

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "how to achieve the vertical center of the title of div in CSS". The editor shows you the operation process through an actual case. The method of operation is simple and fast, and it is practical. I hope that this article "how to achieve the vertical center of the title of div in CSS" can help you solve the problem.

CSS skills

The vertical center title of 1.div vertical-align:middle; adds line spacing to the abnormal height of the entire DIV and later inserts text, which is vertically centered. The error is to control the mode not to change the line.

2. The more the title of margin is configured as float, the more margin will be configured under ie. This is a gap that ie6 has. The design is to add display:inline; to this div, for example:

The corresponding css is

# IamFloat {clear under float:left; margin:5px;/*IE and then familiar with 5px*/ under 10px*/ display:inline;/*IE}

3. Double interval of inoculation of floating ie

# box {float:left; width:100px; margin:0 00 100px; / / the interval display:inline; of 200px occurs in IE under such circumstances / / causes floating to ignore}

Let's talk about block and inline in detail: the characteristic of block element is that it always splits face on new lines, height, width, line height and margin may be controlled (block element); the characteristic of Inline element is that it can not be disciplined (embedded element) in countering line with other elements; # box {display:block; / / outline is the result diplay:table that the embedded element simulates as block element display:inline; / / completes the separation of opposite rows.

This is the end of the content about "how to achieve the vertical center of the title of div in CSS". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

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

Development

Wechat

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

12
Report