Css3 _ quickly understand border-Image

Source: Internet
Author: User
ArticleDirectory
    • Rounded corner
    • Drop Shadow
    • Tab
    • Multiple buttons

When reading this attribute, it seems that Chinese articles have not been too clear to everyone. Let's talk about it today.

Whitebutton.png

 

Then we want to achieve this effect:

 

Code(Haha! Please do not worry, continue to look down):

 Code

< Div Style = "-WebKit-border-image: URL (images/whitebutton.png) 0 12 0 12 stretch;
-Moz-border-image: URL (images/whitebutton.png) 0 12 0 12 round stretch;
Border-image: URL (images/whitebutton.png) 0 12 0 12 stretch;
Display: block;
Width: 600px;
Border-width: 0 12px;
Padding: 10px;
Text-align: center;
Font-size: 16px;
Text-Decoration: Inherit;
Color: White; + color: black ;" > In the safari3 +, ff3.5, chrome5.0 +, and opera10.53 browsers, you can see the border background image. </ Div >

Let's talk about the basic knowledge below:

I. Definition:Border-Image:None| <Image> [
<Number> | <percentage>] {1, 4} [/<border-width> {1, 4}]? [
Stretch | repeat | round] {0, 2}

 

None:
Default value. No background image.
<Image>:
Specify the background image using an absolute or relative URL.

 

 <Number>:

The Border width is expressed by fixed pixel values.
<Percentage>:
The Border width is expressed in percentage.
[Stretch | repeat | round]:

Stretch | duplicate | tile (stretch is the default value .)

Take a look at the CSS code.

 

That is:

They intercept the image in the form of #, and then use stretch | repeat | round to control the horizontal or vertical effect. You will understand it.

  

 

Of course, you can also use % for the Border width. The principle is also the same:

 

Now, you should understand what the border-image is like.

Some examples


Rounded cornerBorderimage

 
Border-width: 10px;
 
Border-image: URL ("Media/roundedcorner.png") 20;
Ninja!
 
Border-width: 20px;
 
Border-image: URL ("Media/border.png") 20;
Drop Shadow Wooooosh
 
Border-width: 10px;
 
Border-image: URL ("Media/blackshadow.png") 5;
Tab Katanas
 
Border-width: 15px 20px 0;
 
Border-image: URL ("Media/tab.png") 20 20 0;
Learn
To be
Lazy
 
Border-width: 10px 10px 0;
Border-image: URL ("Media/gradient.png") 10 10 0;
Multiple buttons Hover & click
 
But not impossible.
 
This one is tricky.

Reference: www.lrbabe.com/sdoms/borderimage/

Ejohn.org/blog/border-image-in-firefox/

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.