Sample code for css implementation of first-word sinking

Source: Internet
Author: User

First look at the code on an instance. Apply the word you want to sink.

Example 1

The code is as follows: Copy code

. First {
Font-size: 320%;/* increase the font percentage */
Float: left;/* left floating */
}

Analysis:

1. Increase the font size.

2. Float left, and then the next line is mentioned


Example 2

The code is as follows: Copy code
. Menglong,. menglong2,. menglong3 {
Width: 300px;
Border: 1px solid # ddd;
Padding: 5px;
Font-size: 12px;
Margin: 5px 0;
}
. Menglong: first-line {
Color: red;
}
. Menglong: first-letter {
Font-size: 350%;
Font-weight: bold;
Color: #000;
Float: left;
}
. Menglong2: first-line {
Letter-spacing:-2px;
}
. Menglong3 {
Text-indent: 2em;
}

Html code:

The code is as follows: Copy code

<! Doctype html>
<Html dir = "ltr" lang = "zh-CN">
<Head>
<Meta charset = "utf-8">
<Title> CSS first word sinking </title>
</Head>
<Body>
<Div class = "menglong"> 2 some sinking and discoloration2 some sinking and discoloration2 some sinking and discoloration2 some sinking and discoloration </div>
<Div class = "menglong"> The first word sink and the first line changes color. The first line changes color. </ div>
<Div class = "menglong2"> The first line is indented, which is closer to the first line. first line indent, closer first line indent, closer </div>
<Div class = "menglong3"> The first line of a paragraph contains two spaces. The first line of a paragraph has two spaces. The first line of a paragraph has two spaces. The first line of a paragraph has two spaces. The first line of a paragraph has two spaces. The first line of a paragraph has two spaces. The first line of a paragraph has two spaces. </Div>
</Body>
</Html>

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.