Pure CSS3 to implement custom graffiti style borders

Source: Internet
Author: User

Original: pure CSS3 to implement custom graffiti style borders

Today we're going to share a custom border app based on Pure CSS3, which looks like a ToolTip control because the bottom border has a small triangle, just like a reference text box in many places. In addition, this CSS3 border is graffiti-style and looks very personal. The benefit of implementing a custom border with CSS3 is the amount of text that can be adapted to the interior of the border.

You can also view the online demo here

Let's share the implementation of the method, mainly composed of HTML code and CSS code.

HTML code:
< Div >    < Div >        < Div > CSS3 Simple Implementation Doodle style border Welcome to</div>    </Div  ></div>

HTML code structure is very simple, just 3 div composition, of course, the following CSS code is the key, we step by step to explain.

CSS code:
{    padding:35px 25px;     width:450px;     margin:40px auto;     background:#586786;     Border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;     color:#eee;     box-shadow:1px 1px 0px rgba (0, 0, 0,.)}

This CSS code defines the outermost border, using the Border-radius to achieve the rounded corners of the border, while taking advantage of the Box-shadow implementation of the class slightly shadow effect, not very obvious, you can also fix a property value to make the shadow more obvious.

. Box{position:relative;background:#fff;Border:Solid 5px #fff;width:200px;Height:100px;margin:0 Auto;Border-radius:255px 15px 225px 15px/15px 225px 15px 255px;padding:10px;Color:#666;Box-shadow:2px 3px 1px rgba (0, 0, 0,.)}. Box:before{content: "";position:Absolute;Bottom:-20px; Left:60px;Border:0;Border-right-width:30px;Border-bottom-width:20px;Border-style:Solid;Border-color:Transparent #fff;Display:Block;width:0;}

This box class and the previous similar, but one more feature, is the use of CSS3: Before attribute to achieve the bottom border of the small triangle effect, so there is the effect of the ToolTip.

 .box. Box  { position : absolute ; : 5px ;  left : 5px ; : 180px ; : 80px ;  Border-color :  #593207 ;  Box-shadow : none ;} .box. Box:before  { left :  45px ;  Border-color :  transparent #593207 ;} 

This is the most internal box, just like the one on the outside of the box, which also uses the Before property to achieve the small triangle effect.

The other is the setting of the border line color and background color, it is very simple. Source code Download >>

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.