MyBlogHelp– A Blog for Digital Marketing, Affiliate Marketing, Organic Lead Generation.
  • Home
  • About
  • Contact
  • Privacy
  • Sitemap
  • BLOG
  • AFFILIATE MARKETING
    • LeadsArk
  • MORE
    • MAKE MONEY
      • ONLINE BUSINESS
      • ADSENSE
      • AFFILIATE MARKETING
    • BLOGGING
      • SEO
      • BlogSpot
      • WORPRESS
      • GOOGLE
      • COMPUTER TIPS
    • WEB DESIGN
      • HTML
      • CSS
      • BOOTSTRAP
      • JAVASCRIPT
      • JQUERY
    • WEB DESIGN
      • HTML
      • CSS
      • BOOTSTRAP
      • JAVASCRIPT
      • JQUERY
    • WEB DEVELOPMENT
      • PHP
      • WORDPRESS
  • DOWNLOADS
    • Blogger Template
    • Wordpress Theme
    • PDF

Tuesday, May 7, 2019

How to use css border-image property? CSS Tutorial 22

 MyBlogHelp     May 07, 2019     css     1 comment   

css border-image property

 

  CSS border-image property

  1. Introduction to CSS border-image property
  2. Syntax of CSS border-image property
  3. Example of CSS border-image property

Introduction to CSS border-image Property

The border box model is very important in CSS. You can separate the content of one element from another element by borders. It is important to design borders when you want to create an attractive website.

There are many properties available in CSS to design border. By which you can define the color of borders, their style (solid, dashed and double, etc.) and width. 

Apart from this, the border-radius property is available to make borders rounded in CSS. Which makes the elements look even more attractive and beautiful.

In the series of border properties, another property has been added to CSS3, which is called border-image property. Through this property, an image can be used as the border of an element.

There are several reasons for using images as a border, as per the theme of the webpage, a beautiful layout can be created using any image as a border.

Image borders look more beautiful than normal borders. Such borders blend perfectly into the theme of the website so that the user does not even know that the borders have been used. 

CSS border-image property can be applied to any element. But when the value collapse of border-collapse property for "th", "tr" and "td" elements is set, then this property can not be used.

In CSS, border-image is a shorthand property, whereby the value of the given properties can be defined at once.
  • border-image-source
  • border-image-slice
  • border-image-width
  • border-image-outset
  • border-image-repeat
Currently, all these properties are not supported by any browser. So you should use the shorthand border-image property to define the image as a border.

Syntax of CSS border-image Property

The general syntax of the CSS border-image property is being given below.

       border-image:  source  slice  width  initialization  repeat;

As you can see in the above syntax, five values are defined for the border-image property. But this property can only be defined by the source value. When you do this, the remaining four default values are used.

All these values have been explained below in detail.

source

This value is the source of the image that you want to use as the border. As the background image define, the image is defined by the url () function. So, even here the url () function is used to define the image.

If you want, you can also define the CSS gradient colors instead of an image as the border. Apart from this, you can also use SVG images for borders. 

Border-image-source property is used to define this value separately. Its syntax has been given below.

border-image-source: url ("address-of-image") | CSS-gradient | SVG;

slice

This value is the number through this you want to slice(cut) the image which is used as a border. Image is always slice in nine parts. In which there are four corners, four sides top, bottom, left and right, and one middle part of the image Four corners of the image always keep fixes. You can manage the other side accordingly.

In addition to the number, this can define value in percent and you can also define the value “fill” which is filled image in the background.

Border-image-slice property is used to define this value separately. Its syntax has been given below.

border-image-slice: number-px | % | fill;

width

This value is the width of the image border. This value is mostly defined in pixels. Border-image-width property is used to define this value separately.

border-image-width: number-px;

outset

This value is a number that represents how much beyond the border image box model it will spread. The border-image-outset property is used to define this value separately.

border-image-outset: number-px;

repeat

This value defines that the border image should be repeated, stretched or rounded. This value can define you repeat, round or stretch.

Repeat value means that the image will be repeated. Stretch means that the area will be stretched to cover the area rather than repeat the image. Round value is used to repeat the image and fill the entire area. 

Border-image-repeat property is used to define this value separately. Its syntax has been given below.

border-image-repeat: repeat | stretch | round;

Example of CSS border-image Property

CSS border-image property has been explained by the below example.

<!DOCTYPE html>
<html>
<head>
 <title> CSS border-image property Example </title>
<style>
#imageBorder1{
     width: 350px;
     margin: 30px;
     padding: 15px;
     border: 20px solid;
     border-image: url(border.png) 150 round;
}
#imageBorder2{
     width: 350px;
     margin: 30px;
     padding: 15px;
     border: 20px solid;
     border-image: url(border.png) 150 stretch;
}
#originalImage, img{
margin: 30px;
}
</style>
</head>
<body>
<p id="imageBorder1"> This paragraph1 has an image border around it. Images are more attractive than normal borders. </P>
<p id="imageBorder2"> This paragraph2 has an image border around it. Images are more attractive than normal borders. </P>
<p id="originalImage"> Original image is here:</p><img src="border1.png">  
</body>
</html>

The above example will produce the below output.


border-image-property-example



          <<-- PREVIOUS                                                               NEXT -->>


  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

1 comment:

  1. YogeshMay 21, 2019 at 3:15 PM

    Keep posting like these information.
    WordPress development company in Chennai

    ReplyDelete
    Replies
      Reply
Add comment
Load more...

Thank you for reading this post. Please do not enter any spam link in the comment box.

Followers

Blog Archive

  • ►  2020 (4)
    • ►  October (1)
    • ►  September (1)
    • ►  August (2)
  • ▼  2019 (52)
    • ►  December (1)
    • ►  November (2)
    • ►  October (1)
    • ►  August (1)
    • ►  July (1)
    • ▼  May (11)
      • How to use css transition property? CSS Tutorial 29
      • How to use css transform property? CSS Tutorial 30
      • How to use css object-fit property? CSS Tutorial 28
      • How to use css filter property? CSS Tutorial 27
      • How to use css @import rule? CSS Tutorial 26
      • How to use css @media query? CSS Tutorial 25
      • How to use css @font-face rule? CSS Tutorial24
      • How to use css text shadow property? CSS Tutorial 23
      • How to use css border-image property? CSS Tutorial 22
      • How to use css pseudo elements? CSS Tutorial 21
      • How to use pseudo class selectors? CSS Tutorial 20
    • ►  April (10)
    • ►  March (6)
    • ►  February (3)
    • ►  January (16)
  • ►  2018 (54)
    • ►  December (27)
    • ►  November (5)
    • ►  May (5)
    • ►  April (4)
    • ►  February (3)
    • ►  January (10)
  • ►  2017 (17)
    • ►  December (9)
    • ►  November (8)

Popular Posts

  • How to use the main tag in html5?
  • How to use keygen tag in html5?
  • How to use html5 mark tag to highlight text?
  • How to start Online Business without money from home?
  • What is a search engine?

Contact Us

Name

Email *

Message *

About MyBlogHelp

Most of the posts, we share on this blog related to Affiliate Marketing, Organic Lead Generation, Digital Marketing, Social Media Marketing, Make Money Online, SEO, and web design.

Featured Post

LeadArk - Affiliate Marketing | Qualified Organic Lead Generation | LeadsArk Review

Copyright © MyBlogHelp– A Blog for Digital Marketing, Affiliate Marketing, Organic Lead Generation.
Design by Md. Abdussamad | MyBlogHelp.com