CSS3 's Sharp Corner label

Source: Internet
Author: User

, the tag tag is usually made with a background image, and now uses the CSS3 code to achieve the sharp corner effect (requires the browser to support the CSS3 property).

Using the CSS3 style to implement a sharp-angle label, simply write a simple HTML structure and CSS style.

<P>    <a>Tag1</a>    <a>Tag2</a>    <a>Tag3</a>    <a>Tag4</a></P>

CSS mainly uses pseudo-elements to achieve sharp corners

a{dispaly:Inline-block;position:relative;background:#ccc;Color:Green;Line-height:1em;margin:0 10px;padding:3px;}A:before{position:Absolute;content:"";width:0;Height:0;Border:Transparent 0.74em Solid;Border-right-color:#ccc;Top:0; Left:-1.4em}

Using pseudo-elements to achieve the sharp angle based on the entire a-label absolute positioning is displayed on the left, note that the line height and positioning are used in the EM unit.

Simple implementation results See:

CSS3 's Sharp Corner label

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.