Bài 3: Hiệu ứng bo tròn (border-radius)

Bình thường, để bo tròn bạn phải sử dụng một tấm ảnh và một số thủ thuật rất phức tạp, trong CSS3 thì rất đơn giản.

border-radius: [kích cỡ];

-moz-border-radius: [kích cỡ];

-webkit-border-radius: [kích cỡ]

Trong đó moz-border-radius dành cho Firefox, -webkit-border-radius dành cho Webkit và border-radius dành cho các trình duyệt khác.

Ví dụ

[codesyntax lang="css"]

border-radius: 10px;

-moz-border-radius: 10px;

-webkit-border-radius: 10px;

[/codesyntax]

Đối với trường hợp không muốn bo tròn toàn bộ

[codesyntax lang="css"]

-moz-border-radius-topright: 10px;

-moz-border-radius-bottomright: 10px;

-webkit-border-top-right-radius: 10px;

-webkit-border-bottom-right-radius: 10px;

[/codesyntax]

Ví dụ này cho thấy các bo tròn phần đầu bên phải và phần chân bên phải, mỗi phần 10px. Cú pháp của Firefox và Webkit khác nhau nên thận trọng để tránh nhầm lẫn.

This entry was posted in CSS3 and tagged , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

3 Comments

  1. thế ngọc
    Posted February 5, 2012 at 8:30 pm | Permalink

    http://border-radius.com/
    Các bạn vào trang này lấy code mà làm nè hihi.

  2. a
    Posted August 9, 2011 at 12:17 pm | Permalink

    Cảm ơn

  3. KaKa
    Posted November 20, 2010 at 9:53 am | Permalink

    Cảm ơn nhiều!

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

yup! xinchao! xacuop! sorry smile! reng! ohgod! nice! miu! meoxinh! leuleu! lac! hic! hi! heo! help! han! gou! good! ghost! fh! cute! byebye! bikini! ;)) :D :)) :)