How Web front-end development uses CSS styles to control H1/H2/H3 labels in HTML does not break lines

Source: Internet
Author: User

H1/H2/H3/H4 title tags are often used in a Web page with unique headings, important columns, important headings, and so on. H1 is best used only once in a Web page, such as a unique title for a Web page. H2, H3, H4 tags can appear multiple times in a Web page, but it is necessary to add or add too much.

In web front-end development, keywords are often optimized using H1 tags, but if a word in a line of text has a H1 tag, it wraps. You can use the following method, the H tag will not force a line break. CSS control for a line of text in a word plus

Display:inline-block;

Although this use, basically IE8 and IE9, Firfox, Chrome browser is no problem, but in IE6 and IE7, but it is not. After verifying the relevant information, the original IE6 and IE7 is supported, just need to

To add a hack, the original code will be compatible with all browsers as follows:

Display:inline-block;

*display:inline;

*zoom:1;

Workaround Example 1:

<style type= "Text/css" >

H1 {font-size:12px;color: #000000; Display:inline}

H2 {font-size:12px;color: #000000; Display:inline}

h3 {font-size:12px;color: #000000; Display:inline}

</style> www.169it.com

Workaround Example 2:

<style type= "Text/css" >

H1 {font-size:12px;color: #000000; Display:inline}

H2 {font-size:12px;color: #000000; Display:inline}

h3 {font-size:12px;color: #000000; Display:inline}

</style>


This article to source: web Front-end development How to use CSS styles to control H1/H2/H3 tags in html no wrap

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.