Use padding to implement highly controllable separation lines and control padding

Source: Internet
Author: User

Use padding to implement highly controllable separation lines and control padding

I. method for implementing the separation line (I don't understand: isn't the vertical direction setting of the span element affected by padding ?)

Html:

1 <div> 2 log on to <span> </span> Register 3 </div>

Css:

1. span {2 padding: 12px 6px 1px;/* You can adjust the upper and lower heights of the air line by changing the first and third parameters, padding-top and padding-bottom */3 margin-left: 12px; 4 border-left: 2px solid #000; 5 font-size: 0; 6}

Implementation principle: Open the chrome browser developer tool to view the box model.

Figure 1: Set the margin-left of the span label to 12px, corresponding to effect 1.

 

 

Figure 2: In order to make the left and right sides of the separation line symmetric, here we set the padding-left and padding-right of span to 6px. Because there is no content in span, the total value is 12px, same as margin-left.

 

Figure 3: Define the left border of the span element as the split line.

 

Figure 4: At this point, adjust padding-top and padding-bottom to increase or decrease the overall height of the box to adjust the separation line.

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.