Table of Contents
CSS3 多重背景图片
Home Web Front-end HTML Tutorial Some useful new css3 properties that I have used_html/css_WEB-ITnose

Some useful new css3 properties that I have used_html/css_WEB-ITnose

Jun 24, 2016 am 11:54 AM

        css3刚推出不久,虽然大多数的css3属性在很多流行的浏览器中不支持,但我个人觉得还是要尽量开始慢慢的去了解并使用css3(还有html5),因为我觉得这是一种趋势,它是一种已经被制定的标准。我并不是专门在做前端的,只是有时不得不自己去写这些东西,有时喜欢研究研究这些,所有以上只是我的个人看法。

 

 1、在之前我想在页面做出一个边框为圆角框,貌似需要写挺多css代码的(可能我没了解到更好的办法),在css3里有一个属性创建圆角是非常容易的 ,设置好角度也可以创建一个圆

border-radius:

     
     

 
 css代码:

 

#test

{

text-align:center;

padding:10px 40px; 

background:gray;

width:350px;

border-radius:10px;

-moz-border-radius:10px; /* 为了让老的 Firefox版本支持 */

}

 

html代码:

border-radius 做圆角的例子。

 

 

2、CSS3 边框阴影,之前我都是直接利用图片做背景实现的效果,用css3中的box-shadow属性也可以做到

box-shadow:

   
        
       

 

css代码:

 

#test1

{

box-shadow: 10px 10px 5px #A5A5A5;

 

width:300px;

height:100px;

}

 

html代码:

 

3、css3 支持背景图片可以用多张图片

 

CSS3 多重背景图片

    

     
        

 

.box

{

width:464px;

height:300px;

background:url(test1.jpg) 0 0 no-repeat,url(test2.jpg) 100% 0 no-repeat;

}

 

4、text-overflow 属性规定当文本溢出包含元素时发生的事情。

此属性支持切断容器中的文本,当文本溢出可以给出了一个省略号的特性。


     
    
  

   
 
 .test3 {

   text-overflow:ellipsis;

   overflow:hidden;

   white-space:nowrap;

   border: 1px solid black;

   width: 400px;

   padding: 20px;

   cursor: pointer;

}

#test3:hover {

  white-space: normal;

  color: rgba(0,0,0,1);

  background: #e3e3e3;

  border: 1px solid #666;

}

当这里显示的内容溢出是会有省略号,鼠标移到文本上面会显示所有内容

5. Transition effect, through CSS3, we can change the element when Add effects to elements when transforming from one style to another. < style>

div

{

width:100px;

height:100px;

background:blue;

transition:width 2s, height 2s;

-moz-transition:width 2s, height 2s, -moz-transform 2s; /* Can support Firefox 4 */

-webkit-transition: width 2s, height 2s, -webkit-transform 2s; /* Can support Safari and Chrome */

-o-transition:width 2s, height 2s, -o-transform 2s; /* Can support Opera */

}

div:hover

{

width:200px;

height:200px;

transform:rotate(180deg);

-moz-transform:rotate(180deg); /* Can support Firefox 4 */

-webkit-transform:rotate(180deg); /* Can support Safari and Chrome */

-o-transform:rotate(180deg); /* Can support Opera * /

}

Place the mouse over this area to see the transition effect.

Statement of this Website
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

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

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Is HTML easy to learn for beginners? Is HTML easy to learn for beginners? Apr 07, 2025 am 12:11 AM

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Apr 04, 2025 pm 11:54 PM

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

What is an example of a starting tag in HTML? What is an example of a starting tag in HTML? Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

How to use CSS3 and JavaScript to achieve the effect of scattering and enlarging the surrounding pictures after clicking? How to use CSS3 and JavaScript to achieve the effect of scattering and enlarging the surrounding pictures after clicking? Apr 05, 2025 am 06:15 AM

To achieve the effect of scattering and enlarging the surrounding images after clicking on the image, many web designs need to achieve an interactive effect: click on a certain image to make the surrounding...

HTML, CSS, and JavaScript: Essential Tools for Web Developers HTML, CSS, and JavaScript: Essential Tools for Web Developers Apr 09, 2025 am 12:12 AM

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

How to implement adaptive layout of Y-axis position in web annotation? How to implement adaptive layout of Y-axis position in web annotation? Apr 04, 2025 pm 11:30 PM

The Y-axis position adaptive algorithm for web annotation function This article will explore how to implement annotation functions similar to Word documents, especially how to deal with the interval between annotations...

See all articles