Home > Article > Web Front-end > How to achieve a special single-sided css box effect (code example)
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:
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!