CSS3 A simple example of drawing a rounded rectangle

Source: Internet
Author: User

With the development of the network, CSS is also constantly improving, fully absorbing the needs of the Web development for many years, put forward a lot of new CSS features, such as the very popular rounded rectangle Border-radius properties, but unfortunately, this property is not currently supported by any browser.

For some browsers, they have a private fillet property. such as FF's-moz-border-radius, Safari and Chrome's-webkit-border-radius. See the results:

Rounded corners of FF

Safari and Chrome fillet (Safari and chrome use the same kernel, which only has Chrome effect)

IE and Opera There is no private fillet properties, if any, the production of rounded corners should be much simpler, the respective private properties are all written, so that each browser "seat", to achieve the "compatibility" effect.

An example of a Baidu has ah css fillet scenario is given below:

Xml/html Code

  1. < Div class="Box1">

  2.     <span class="TL"></span><span class="TR"></span>  

  3. &NBSP;&NBSP;&NBSP;&NBSP; <, div class = >

  4. &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < p > </ >

  5. </div >

  6.     <span class="BL"></span><span class="BR"></span>  

  7. </ Div >   

CSS Code:

JavaScript Code

  1. . box1 {

  2. Background:url (images/bg1.gif) repeat-x #1d6cb7;

  3. Margin-top:1em;

  4. position:relative;

  5. Zoom:1;

  6. width:778px;

  7. }

  8. . box1. TL,. box1. TR,. box1. BL,. Box1. br {

  9. width:5px;

  10. height:5px;

  11. Position:absolute;

  12. Background:url (images/bg3.gif) no-repeat;

  13. Overflow:hidden;

  14. }

  15. . box1. cc {

  16. height:40px;

  17. padding:5px;

  18. }

  19. . box1. TL {

  20. left:0;

  21. top:0;

  22. }

  23. . box1. tr {

  24. right:0;

  25. top:0;

  26. Background-position:0 -5px;

  27. }

  28. . box1. BL {

  29. left:0;

  30. bottom:0;

  31. Background-position:0 -10px;

  32. }

  33. . box1. BR {

  34. right:0;

  35. bottom:0;

  36. Background-position:0 -15px;

  37. }



CSS3 A simple example of drawing a rounded rectangle

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.