Home >Web Front-end >CSS Tutorial >How to achieve a special single-sided css box effect (code example)

How to achieve a special single-sided css box effect (code example)

不言
不言Original
2018-11-07 16:39:352532browse

With the development of CSS3, the progress of web development has moved towards perfect imagination. For text and other usages, CSS drop-shadow can achieve a good-looking effect box. Let’s look directly at the specific code.

This is the html part:

<div id="beauty-boxes">Some example text</div>

CSS code

 #beauty-boxes{
     transition: all 0.5s ease;
     position:relative;
     float:left;
     width:45%;
     padding:2px;
     margin:3px;
     background:#fff;
     -webkit-box-shadow:0 1px 4px rgba(0, 0, 0, 0), 0 0 40px rgba(0, 0, 0, 0) inset;
     -moz-box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0) inset;
     box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0) inset;
     -moz-border-radius:4px;
     border-radius:4px;
     } 
    #beauty-boxes:before,
    #beauty-boxes:after {
     content:"";
     position:absolute;
     z-index:-3;
     bottom:15px;
     left:12px;
     width:50%;
     height:20%;
     max-width:350px;
     max-height:90px;
     -webkit-box-shadow:0 15px 10px rgba(0, 0, 0, 0.7);
     -moz-box-shadow:0 15px 10px rgba(0, 0, 0, 0.7);
     box-shadow:0 15px 10px rgba(0, 0, 0, 0.7);
     -webkit-transform:rotate(-3deg);
     -moz-transform:rotate(-3deg);
     -ms-transform:rotate(-3deg);
     -o-transform:rotate(-3deg);
     transform:rotate(-3deg);
      }
 #beauty-boxes:after {
     right:10px;
     left:auto;
     -webkit-transform:rotate(3deg);
     -moz-transform:rotate(3deg);
     -ms-transform:rotate(3deg);
     -o-transform:rotate(3deg);
     transform:rotate(3deg);
 }.beauty-boxes p {
     font-size:16px;
     font-weight:bold;
 }
   #beauty-boxes:hover{
    background-color:#161616;
   color:#fff;
    }

The effect is as follows:

How to achieve a special single-sided css box effect (code example)


The above is the detailed content of How to achieve a special single-sided css box effect (code example). 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