search
HomeWeb Front-endFront-end Q&AWhat are the new features of css3 borders?

What are the new features of css3 borders?

Dec 14, 2021 pm 06:03 PM
css3Border properties

The newly added features of css3 border include: border-radius, border-image, border-image-outset, border-image-repeat, border-image-slice, border-image-width, etc.

What are the new features of css3 borders?

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

Newly added features (properties) of css3 borders

Properties Description CSS
border-radius Sets or retrieves the rounded border of an object.
border-bottom-left-radius Sets or retrieves the lower left corner rounded border of the object. Provide 2 parameters, separated by spaces. Each parameter is allowed to set 1 parameter value. The first parameter represents the horizontal radius, and the second parameter represents the vertical radius. If the second parameter is omitted, it defaults to the 1st parameter. Parameters 3
border-bottom-right-radius Set or retrieve the rounded border of the lower right corner of the object. 3
border-top-left-radius Define the shape of the upper left border. 3
border-top-right-radius Define the shape of the upper right border. 3
border-image Sets or retrieves the object's border style to fill with an image. 3
border-image-outset Specifies the amount by which the border image exceeds the border. 3
border-image-repeat Specifies whether the image border should be repeated, stretched, or covered ( rounded). 3
border-image-slice Specifies the inward offset of the image border. 3
border-image-source Specifies the image to be used in place of the border style set in the border-style property. 3
border-image-width Specifies the width of the image border. 3
box-decoration-break Specifies that inline elements are broken 3
box-shadow Add one or more shadows to the box. 3
box-reflect Sets or retrieves the reflection of an object 3

border-image

The new border attribute in CSS3 expands the functionality of the original box model and enables the border to have background image attributes. Previously, border only had width, color and style attributes.

To implement border background image attributes, padding and background attributes are usually used for simulation, but this increases the difficulty of setting the background of the box

Grammar format: ​ ​ The syntax is         CSS      Abbreviation style                                                                                                                                                                    

# ​ ​ ​

Description:

​ ​ Set or retrieve the border style of an object using an image path.

Specify an image to be used to replace the border-style border style attribute. When border-image is none or the image is invisible, the border style effect defined by border-style will be displayed. The corresponding script feature is borderImageSource. Value:    

     none: No background image.

None: No background image.

   : Specify the image using an absolute or relative address.

   : Specify the image using an absolute or relative address.

[ border-image-slice segmentation method ]

      

                

Description:

         

                                                                                                                                             

This attribute specifies to separate the image from the top, right, bottom, and left directions. The image is divided into 4 corners, 4 sides and a middle area, a total of 9 parts. The middle area is always transparent (that is, there is no image filling) ), unless the keyword fill is added. The corresponding script feature is borderImageSlice.

Value:                                              :Specify the width with a floating point number. Negative values ​​are not allowed.

   : Specify the width as a percentage. Negative values ​​are not allowed.

[

 

/ [ border-image-width border width]? |    

  

​ ​ ​ Description: ​ ​

Set or retrieve the border thickness of the object. This attribute is used to specify how thick the border is to be used to carry the cropped image.

   This attribute can be omitted and is defined by the external border-width. The corresponding script feature is borderImageWidth. Value: ​ ​ ​

   : Use the length value to specify the width. Negative values ​​are not allowed.

   : Specify the width as a percentage. Negative values ​​are not allowed.

   : Use a floating point number to specify the width. Negative values ​​are not allowed.

  Auto: If the auto value is set, border-image-width takes the same value as border-image-slice.

                                   should will need to be added to the box model. Chrome will have a size of 3 pixels, and the border size of other browsers will still be 0 |

/ [border-image-outset extension method]

Description:

Set or retrieve the background diagram of the object of the object.

This attribute is used to specify the value defined by the outward expansion of the border image. That is, if the value is 10px, the image will be extended 10px outward on the original basis before displaying.

The corresponding script feature is borderImageOutset.

Value:

​ ​ ​

   : Specify the width with a length value. Negative values ​​are not allowed.

   : Use a floating point number to specify the width. Negative values ​​are not allowed.

]

 [border-image-repeat repeat mode]       

                      

Description:

           

                                                                                                                                                        

   This attribute is used to specify the filling method of the border background image. 0-2 parameter values ​​can be defined, namely horizontal and vertical directions. If the two values ​​are the same, they can be merged into one, indicating that the border background image is filled in the same way in both horizontal and vertical directions; if both values ​​are stretch, they can be omitted.

The corresponding script feature is borderImageOutset.

     Stretch: Specify the background diagram of the frame with stretching method.

Repeat: Specify the tiling method to fill the border background image. When the image hits the boundary, it will be truncated if it exceeds it.

Round: Specify a tiling method to fill the border background image. The image will dynamically adjust its size according to the size of the border until it just fits the entire border. At the time of writing this document, this effect can only be seen in Firefox

Space: Specifies a tiling method to fill the border background image. The picture will dynamically adjust the spacing between the pictures according to the size of the border until it can exactly cover the entire border. At the time of writing this document, no browser can see this effect

CSS3 New Property Example

##1、

<style>
    div{
        width:300px;
        height:300px;
        background:url(./shuaige.jpg) no-repeat center  ;
        border-image-source:none;
    }
</style>
</head>
<body>
    <div></div>
</body>
2、

<style>
div{
    width:300px;
    height:300px;
    background:url(./shuaige.jpg) center no-repeat ;
    border-image-source:url(./border.png);/*边框图片属性*/
    border-image-width:27px;/*边框图片宽度属性*/
    border-image-slice:27;/*边框图片切割属性*/
    border-image-outset:0px;/*边框图片扩展属性*/
    border-image-repeat:stretch;/*边框图片重复属性*/
}
</style>
</head>
<body>
    <div>
    </div>
</body>
3,

<style>
div{
    width:300px;
    height:300px;
    background:url(shuaige.jpg) no-repeat center;
    border-image-source:url(border.png);
    border-image-width:27px;
    border-image-slice:27;
    border-image-outset:0px;
    border-image-repeat:repeat;/*设定重复方式为重复*/
}
</style>
</head>
<body>
    <div>
    </div>
</body>
4,

<style>
            div{
                width:300px;
                height:300px;
                background:url(shuaige.jpg) no-repeat center;
                border-image-source:url(border.png);
                border-image-width:27px;
                border-image-slice:27;
                border-image-outset:0px;
                border-image-repeat:round;/*设定重复方式为round   会看情况进行缩放或缩小*/
            }
        </style>
    </head>
    <body>
        <div>
        </div>
    </body>
5,

<style>
    div{
        width:300px;
        height:300px;
        background:url(./shuaige.jpg) center no-repeat ;
        border-image-source:url(./border.png);/*边框图片属性*/
        border-image-width:27px;/*边框图片宽度属性*/
        border-image-slice:27 fill;
        /*设定边框图片背景填充内容部分,会显示第5块切割的内容*/
        border-image-outset:0px;/*边框图片扩展属性*/
        border-image-repeat:stretch;/*边框图片重复属性*/
    }
</style>
</head>
<body>
    <div>
    </div>
</body>
6,

<style>
    div{
        width:300px;
        height:300px;
        background:url(./shuaige.jpg) center no-repeat ;
        border-image-source:url(./border.png);
        border-image-width:27px;
        border-image-slice:54;/*切割为宽度的2倍   会自动缩放*/
        border-image-outset:0px;
        border-image-repeat:stretch;
    }
</style>
</head>
<body>
<div>
</div>
</body>
7、

<style>
    div{
        width:300px;
        height:300px;
        background:url(./shuaige.jpg) center no-repeat ;
        border-image-source:url(./border.png);
        border-image-width:27px;
        border-image-slice:81;/*切割为宽度的3倍*/
        border-image-outset:0px;
        border-image-repeat:stretch;
    }
</style>
</head>
<body>
<div>
</div>
</body>
8、

<style>
    div{
        width:300px;
        height:300px;
        background:url(./shuaige.jpg) center no-repeat ;
        border-image-source:url(./border.png);
        border-image-width:27px;
        border-image-slice:27;
        border-image-outset:154px;/*向外扩展的大小*/
        border-image-repeat:repeat;
    }
</style>
</head>
<body>
<div>
</div>
</body>
(Learning video sharing: css video tutorial

)

The above is the detailed content of What are the new features of css3 borders?. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
HTML and React's Integration: A Practical GuideHTML and React's Integration: A Practical GuideApr 21, 2025 am 12:16 AM

HTML and React can be seamlessly integrated through JSX to build an efficient user interface. 1) Embed HTML elements using JSX, 2) Optimize rendering performance using virtual DOM, 3) Manage and render HTML structures through componentization. This integration method is not only intuitive, but also improves application performance.

React and HTML: Rendering Data and Handling EventsReact and HTML: Rendering Data and Handling EventsApr 20, 2025 am 12:21 AM

React efficiently renders data through state and props, and handles user events through the synthesis event system. 1) Use useState to manage state, such as the counter example. 2) Event processing is implemented by adding functions in JSX, such as button clicks. 3) The key attribute is required to render the list, such as the TodoList component. 4) For form processing, useState and e.preventDefault(), such as Form components.

The Backend Connection: How React Interacts with ServersThe Backend Connection: How React Interacts with ServersApr 20, 2025 am 12:19 AM

React interacts with the server through HTTP requests to obtain, send, update and delete data. 1) User operation triggers events, 2) Initiate HTTP requests, 3) Process server responses, 4) Update component status and re-render.

React: Focusing on the User Interface (Frontend)React: Focusing on the User Interface (Frontend)Apr 20, 2025 am 12:18 AM

React is a JavaScript library for building user interfaces that improves efficiency through component development and virtual DOM. 1. Components and JSX: Use JSX syntax to define components to enhance code intuitiveness and quality. 2. Virtual DOM and Rendering: Optimize rendering performance through virtual DOM and diff algorithms. 3. State management and Hooks: Hooks such as useState and useEffect simplify state management and side effects handling. 4. Example of usage: From basic forms to advanced global state management, use the ContextAPI. 5. Common errors and debugging: Avoid improper state management and component update problems, and use ReactDevTools to debug. 6. Performance optimization and optimality

React's Role: Frontend or Backend? Clarifying the DistinctionReact's Role: Frontend or Backend? Clarifying the DistinctionApr 20, 2025 am 12:15 AM

Reactisafrontendlibrary,focusedonbuildinguserinterfaces.ItmanagesUIstateandupdatesefficientlyusingavirtualDOM,andinteractswithbackendservicesviaAPIsfordatahandling,butdoesnotprocessorstoredataitself.

React in the HTML: Building Interactive User InterfacesReact in the HTML: Building Interactive User InterfacesApr 20, 2025 am 12:05 AM

React can be embedded in HTML to enhance or completely rewrite traditional HTML pages. 1) The basic steps to using React include adding a root div in HTML and rendering the React component via ReactDOM.render(). 2) More advanced applications include using useState to manage state and implement complex UI interactions such as counters and to-do lists. 3) Optimization and best practices include code segmentation, lazy loading and using React.memo and useMemo to improve performance. Through these methods, developers can leverage the power of React to build dynamic and responsive user interfaces.

React: The Foundation for Modern Frontend DevelopmentReact: The Foundation for Modern Frontend DevelopmentApr 19, 2025 am 12:23 AM

React is a JavaScript library for building modern front-end applications. 1. It uses componentized and virtual DOM to optimize performance. 2. Components use JSX to define, state and attributes to manage data. 3. Hooks simplify life cycle management. 4. Use ContextAPI to manage global status. 5. Common errors require debugging status updates and life cycles. 6. Optimization techniques include Memoization, code splitting and virtual scrolling.

The Future of React: Trends and Innovations in Web DevelopmentThe Future of React: Trends and Innovations in Web DevelopmentApr 19, 2025 am 12:22 AM

React's future will focus on the ultimate in component development, performance optimization and deep integration with other technology stacks. 1) React will further simplify the creation and management of components and promote the ultimate in component development. 2) Performance optimization will become the focus, especially in large applications. 3) React will be deeply integrated with technologies such as GraphQL and TypeScript to improve the development experience.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software