1. Bạn dùng "photoshop" để tạo nên một hình khối có 4 góc bo tròn.
2. Cắt hình này thành 4 hình tương ứng với 4 góc.
3. Trong code html, bạn viết như sau:
<div class="boxwrap">
<div>
<div>
<div>
Nội dung bên trong khối có 4 góc bo tròn...
</div>
</div>
</div>
</div>
Bạn có thầy là ta dùng 4 thẻ div lồng nhau không? Đó là lý do tại sao đây được gọi là kỹ thuật 4div đó ^^.
4. Còn trong phần CSS, ta định dạng như sau:
div.boxwrap {
margin: 50px auto 0;
padding: 0;
background: url(images/br.gif) no-repeat right bottom;
width: 15%;
color: #FFF;
}
div.boxwrap div {
background: url(images/bl.gif) no-repeat left bottom;
}
div.boxwrap div div {
background: url(images/tr.gif) no-repeat right top;
}
div.boxwrap div div div {
background: url(images/tl.gif) no-repeat left top;
padding: 20px;
}
----------
<div style=" height:200px; width:368px; background:url('http://www.bodua.com/Imgs/Banner/H5.Jpg') no-repeat; border-radius:10px;"></div>
----------
<div style="width:357px;overflow:hidden;border-radius:16px;box-shadow:3px 6px 12px #383838;">
<img src="http://tapchilamdep.com/images/news/content_images/ year2007/month9/190907dautay.jpg" alt="" width="370">
</div>
<img src="http://tapchilamdep.com/images/news/content_images/ year2007/month9/190907dautay.jpg" alt="" width="370">
</div>