search
HomeWeb Front-endCSS TutorialWhat are the new attributes of css3? Summary of new attributes commonly used in css3

What are the new attributes of css3? Anyone who asks this question should know that css3 is an upgraded version of css. So, since css3 is an upgraded version, it will naturally add some new attributes. Next, this article will introduce to you about css3 Commonly used new attributes.

1. New border attributes in css3

1. Border-color, a new attribute in css3: Set multiple colors for the border

p
  {
  border-style:solid;  
  border-color:#ff0000 #0000ff;
  }

Let me digress here. It should be noted that the "border-width" attribute will not work if used alone. Please set the border first using the "border-style" property.

2. Border-image, a new attribute of css3: picture border

The border-image attribute of css3 uses images to create borders

div
{
-webkit-border-image:url(border.png) 30 30 round; /* Safari 5 */
-o-border-image:url(border.png) 30 30 round; /* Opera */
border-image:url(border.png) 30 30 round;
}

Note: Internet Explorer does not support the border-image attribute; the border-image attribute specifies the image used as the border.

3. Border-radius, a new attribute in css3: rounded border

div
{
border:2px solid;
border-radius:25px;
}

4. Box-shadow, a new attribute in css3: shadow effect

box-shadow in css3 is used to add shadow to the box

div
{
box-shadow: 10px 10px 5px #888888;
}

2. New background attribute in css3

1 . Background-size, a new attribute of CSS3: Specify the size of the background image

Before CSS3, the size of the background image was determined by the actual size of the image. In CSS3, the size of the background image can be specified, which allows us to reuse the background image in different environments. You can specify dimensions in pixels or percentages. If the dimensions are specified as a percentage, the dimensions are relative to the width and height of the parent element.

div
{
background:url(img_flwr.gif);
background-size:80px 60px;
background-repeat:no-repeat;
}

2. Background-origin, a new attribute in css3: Specify where to start displaying the background image.

The background image can be placed in the content-box and padding -box or border-box area.

div
{
background-image:url('smiley.gif');
background-repeat:no-repeat;
background-position:left;
background-origin:content-box;
}

3. Background-clip, a new attribute in css3: Specify where to start cutting the background image

div
{
background-color:yellow;
background-clip:content-box;
}

3. New text effects in css3

1. Text-shadow, a new attribute in css3: text shadow

h1
{
text-shadow: 5px 5px 5px #FF0000;
}

Description:

(1) and are optional. When is not specified, the text color will be used; when is not specified, the radius value is 0;

(2) shadow can be a comma separated list, such as: text-shadow: 2px 2px 2px #ccc, 3px 3px 3px #ddd;

(3) The shadow effect will be as follows The order specified in the shadow list is applied to the elements;

(4) These shadow effects may overlap each other, but will not overlap the text itself;

(5) The shadow may run to the container outside the bounds, but does not affect the size of the container.

2. Word-wrap, a new attribute in css3: automatic line wrapping

If a word is too long, it may not exceed a certain area, allowing long words to be split. , and wrap to the next line

p {word-wrap:break-word;}

4. New animation effect in css3

1. Transform transformation effect:

css3 provides element deformation effects, also called transformations. It can rotate, scale and translate elements.

Attribute value: (1) transform; (2) transform-origin: The transform-origin attribute can set the starting point of the transformation. By default, the center of the element is used as the starting point.

2. animation animation effect

CSS3 provides animation effects similar to Flash keyframe control, which is achieved through the animation attribute. Then the previous transition attribute can only achieve animation effects by specifying the initial state and end state of the attribute, which has certain limitations.

animation Realizing animation effects mainly consists of two parts: 1. Declaring an animation through key frames similar to Flash animation; 2. Calling the animation declared by key frames in the animation attribute.

5. New transition effect in css3

1. Transition transition effect

The transition effect is generally passed Some simple CSS actions trigger smooth transition functions, such as :hover, :focus, :active, :checked, etc. CSS3 provides the transition attribute to implement this transition function.

For the new transition content and new animation effects of CSS3, you can also refer to CSS3 latest version reference manual. The content is very detailed.

This article ends here. The above is a summary of the new common attributes in CSS3.

Related recommendations:

What are the new background attributes of CSS3

The new attributes of CSS3 and their usage

The above is the detailed content of What are the new attributes of css3? Summary of new attributes commonly used in css3. 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
Where should 'Subscribe to Podcast' link to?Where should 'Subscribe to Podcast' link to?Apr 16, 2025 pm 12:04 PM

For a while, iTunes was the big dog in podcasting, so if you linked "Subscribe to Podcast" to like:

Browser Engine DiversityBrowser Engine DiversityApr 16, 2025 pm 12:02 PM

We lost Opera when they went Chrome in 2013. Same deal with Edge when it also went Chrome earlier this year. Mike Taylor called these changes a "Decreasingly

UX Considerations for Web SharingUX Considerations for Web SharingApr 16, 2025 am 11:59 AM

From trashy clickbait sites to the most august of publications, share buttons have long been ubiquitous across the web. And yet it is arguable that these

Weekly Platform News: Apple Deploys Web Components, Progressive HTML Rendering, Self-Hosting Critical ResourcesWeekly Platform News: Apple Deploys Web Components, Progressive HTML Rendering, Self-Hosting Critical ResourcesApr 16, 2025 am 11:55 AM

In this week's roundup, Apple gets into web components, how Instagram is insta-loading scripts, and some food for thought for self-hosting critical resources.

Git Pathspecs and How to Use ThemGit Pathspecs and How to Use ThemApr 16, 2025 am 11:53 AM

When I was looking through the documentation of git commands, I noticed that many of them had an option for . I initially thought that this was just a

A Color Picker for Product ImagesA Color Picker for Product ImagesApr 16, 2025 am 11:49 AM

Sounds kind of like a hard problem doesn't it? We often don't have product shots in thousands of colors, such that we can flip out the with . Nor do we

A Dark Mode Toggle with React and ThemeProviderA Dark Mode Toggle with React and ThemeProviderApr 16, 2025 am 11:46 AM

I like when websites have a dark mode option. Dark mode makes web pages easier for me to read and helps my eyes feel more relaxed. Many websites, including

Some Hands-On with the HTML Dialog ElementSome Hands-On with the HTML Dialog ElementApr 16, 2025 am 11:33 AM

This is me looking at the HTML element for the first time. I've been aware of it for a while, but haven't taken it for a spin yet. It has some pretty cool and

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools