Rounded corners

Discussion in 'HTML & Website Design' started by Scorpiono, Sep 6, 2008.

  1. #1
    What's your favorite way to create rounded corners for the main body element, just like crazyegg.com's.

    I'm having a hard time slicing it as it creates a fixed width, as for using tons of <div>'s with specific backgrounds makes the main HTML code a bit too crowded.

    Javascript I've heard it's slow but would implement it if I knew any techniques.

    What's your favorite?
     
    Scorpiono, Sep 6, 2008 IP
  2. FaceJolt

    FaceJolt Guest

    Messages:
    495
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Use 4 corners is my approach.
     
    FaceJolt, Sep 6, 2008 IP
  3. xira

    xira Active Member

    Messages:
    315
    Likes Received:
    8
    Best Answers:
    4
    Trophy Points:
    68
    #3
    xira, Sep 7, 2008 IP
  4. -Hammad-

    -Hammad- Peon

    Messages:
    37
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Why use 'tons of <div>'s'? Create a class for each corner, then call it, and you're done.
     
    -Hammad-, Sep 7, 2008 IP
  5. Guthix121

    Guthix121 Well-Known Member

    Messages:
    1,078
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    105
    #5
    Guthix121, Sep 7, 2008 IP
  6. Scorpiono

    Scorpiono Well-Known Member

    Messages:
    1,330
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    120
    #6
    Because...

     
    Scorpiono, Sep 7, 2008 IP
  7. levikay

    levikay Active Member

    Messages:
    294
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    68
    #7
    The best way of doing this is to use image,
    The CSS way to very limited.
     
    levikay, Sep 7, 2008 IP
  8. Scorpiono

    Scorpiono Well-Known Member

    Messages:
    1,330
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    120
    #8
    so, fixed layout?
     
    Scorpiono, Sep 7, 2008 IP
  9. Valdum

    Valdum Guest

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Use CSS, and div tags: This is from my site.

    <style>

    #left-top {
    float: left;
    width: 5px;
    height:28px;
    font-size: 2px;
    background-image: url(../images/orangetop.jpg);
    background-repeat:no-repeat;
    background-position: 0 0;
    }

    #right-top {
    float: right;
    width: 5px;
    height:28px;
    font-size: 2px;
    background-image: url(../images/orangetop.jpg);
    background-repeat:no-repeat;
    background-position: 0 -28px;
    }

    #center-top{
    padding: 5px 5px 10px 5px;
    background-image: url(../images/orangetop.jpg) repeat-x;
    background-repeat:repeat-x;
    background-position: 0 -56px;
    border-left: 1px solid #CCCCCC;
    border-right: 1px solid #CCCCCC;
    text-align:left;
    }

    #left-bottom {
    float: left;
    width: 5px;
    height:5px;
    font-size: 2px;
    background-image: url(../images/container.png);
    background-repeat:no-repeat;
    background-position:0px 0px;
    }

    #mid-bottom {
    font-size: 2px;
    height:5px;
    background-image: url(../images/container.png);
    background-repeat:repeat-x;
    background-position:0px -12px;
    }

    #right-bottom
    {
    float: right;
    width: 5px;
    height:5px;
    font-size: 2px;
    background-image: url(../images/container.png);
    background-repeat:no-repeat;
    background-position:0px -6px;
    }


    </style



    <div id="left-top"></div>
    <div id="right-top"></div>
    <div id="center-top">
    <p>Your content here </p>
    </div>
    <div id="mid-bottom">
    <div id="leftcorner-bottom"></div>
    <div id="rightcorner-bottom"></div>
    </div>
     
    Valdum, Sep 9, 2008 IP
  10. spicemint

    spicemint Active Member

    Messages:
    194
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #10
    You can 'JQuery' for rounding the corners of HTML elements. I don't know much about it's performance. We can do lot of things using small number of JavaScript codes.
     
    spicemint, Sep 9, 2008 IP
  11. Website Templates

    Website Templates Peon

    Messages:
    43
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #11
    why can't you just use a bottom and top image with rounded corners instead of four corners?
     
    Website Templates, Sep 9, 2008 IP
  12. Kevin Design

    Kevin Design Guest

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    I agree, a lot of the time if you try using CSS only the result is lots of markup - with images it allows the best results and also more control over design in my experience.
     
    Kevin Design, Sep 9, 2008 IP
  13. fotoviva

    fotoviva Active Member

    Messages:
    265
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    60
    #13
    This enables the box to expand and contract according to the content.

    You could use htmlDog method:
    p {
    color: black;
    background: red url(images/tl.gif) top left no-repeat;
    }

    p span {
    display: block; /* sets all spans inside p to block, so only need this once */
    background: url(images/tr.gif) top right no-repeat;
    }

    p span span {
    background: url(images/br.gif) bottom right no-repeat;
    }

    p span span span {
    padding: 2em;
    height: 0; /* fixes a padding bug in IE */
    background: url(images/bl.gif) bottom left no-repeat;
    }

    p span span > span {
    height: auto; /* sets the height back to auto for all other browsers */
    }

    then html:
    <p><span><span><span>
    test text goes here.
    </span></span></span> </p>
     
    fotoviva, Sep 9, 2008 IP
  14. darkmessiah

    darkmessiah Peon

    Messages:
    500
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Probably the most important part to remember, or you'll see a white space between your divs, very annoying and a pain to figure out sometimes.
     
    darkmessiah, Sep 9, 2008 IP
  15. dreamcon

    dreamcon Peon

    Messages:
    90
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #15
    there are many ways to design a website layout for your website.......to do rounded corners, i prefer to use images anstead of css....and you can also declare one class and call it wherever it is necessary.....
     
    dreamcon, Sep 9, 2008 IP
  16. Scorpiono

    Scorpiono Well-Known Member

    Messages:
    1,330
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    120
    #16
    Width flexibility
     
    Scorpiono, Sep 10, 2008 IP
  17. VarriaStudios

    VarriaStudios Member

    Messages:
    246
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #17
    yup, you are very off using images,

    an easy way to approach the issue is by coding a box

    split the top in 3 sections, LEFT corner, CENTER img, RIGHT corner,

    then center for content , center img

    and repeat for the bottom, LEFT corner, CENTER img, RIGHT corner,

    this should help when auto stretching.

    regards,
     
    VarriaStudios, Sep 10, 2008 IP
  18. kirit

    kirit Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #18
    just use above ans
     
    kirit, Sep 10, 2008 IP