1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Simple css question - rounded corners

Discussion in 'CSS' started by le007, Oct 11, 2007.

  1. #1
    How do I change from 3 column layout to a 2 column layout when I click a link on my menu?

    EG - homepage (index.html) is a 3 col layout
    link1.html I want to be a 2 col layout

    Is the only way something like:

    index.html
    #left
    {width: 25%;}
    #content
    {width: 50%;}
    #right
    {width: 25%;}

    link1.html
    #left1
    {width: 75%;}
    #right1
    {width: 25%}

    ???????????

    Also if I have 4 rounded corners (gif's made) how to position them into the corners of a div?

    Thanks,
    Leo
     
    le007, Oct 11, 2007 IP
  2. Synchronium

    Synchronium Active Member

    Messages:
    463
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #2
    The only ways to do rounded corners are 1) tables and 2) javascript library

    I opted for #1, instead of a 40k js library. Click the link in my sig for an example.
     
    Synchronium, Oct 11, 2007 IP
  3. MeetHere

    MeetHere Prominent Member

    Messages:
    15,399
    Likes Received:
    994
    Best Answers:
    0
    Trophy Points:
    330
    #3
    There are lots of javascripts available on net..
    Also you can find good tutorials on borders.
     
    MeetHere, Oct 11, 2007 IP
  4. le007

    le007 Well-Known Member

    Messages:
    481
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #4
    I did and all I got was Cannabis seeds!

    There is a way of doing cornered div WITHOUT tables, its about positioning the gifs but I'm not sure how
     
    le007, Oct 11, 2007 IP
  5. KatieK

    KatieK Active Member

    Messages:
    116
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    58
    #5
    Hey le007, I saw your question here and at CSS Creator.

    My CSS way for doing rounded corners is via background images. I've attached the two images that I use, for reference. Start with a div that's got box_bottom.png as the background image. Inside that div, put your content, with an H1 at the top. Put goomba_box.png as the bg image on that H1. Specify widths on the out elements, and padding on the inner elements. The nice thing about the outrageously tall box_bottom image is that it expands as more content is put in the div.

    You'll need to add a couple more elements (probably divs) if you want to use 4 images instead of 2. Each element can only have one background image.
     

    Attached Files:

    KatieK, Oct 11, 2007 IP
  6. madk

    madk Peon

    Messages:
    141
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You can and should do rounded corners with 100% css. Basically emulate how you could do it with a table and convert it to divs.

    <div class = "header"></div>
    <div class = "body">content</div>
    <div class = "footer"></div>

    In css set the height, width and background for the header and footer and you are all set. You will probably have to adjust your gifs a bit but regardless this'll work with minimal effort.
     
    madk, Oct 11, 2007 IP
  7. le007

    le007 Well-Known Member

    Messages:
    481
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #7
    Hey Katie how are you?
    Thanks for that - I'll give it a go!
     
    le007, Oct 11, 2007 IP
  8. Sutocu

    Sutocu Active Member

    Messages:
    938
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    60
    #8
    Yeah that works for fixed width layouts at least. But will it work for fluid width ones?
     
    Sutocu, Oct 11, 2007 IP
  9. le007

    le007 Well-Known Member

    Messages:
    481
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #9
    Has anyone any actual code example pls?
     
    le007, Oct 11, 2007 IP
  10. KatieK

    KatieK Active Member

    Messages:
    116
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    58
    #10
    Le007,

    I didn't want to shill too much, but you can see the box I made with those images on my blog at http://www.peh2.com/code.php#equal_columns.

    Here's the CSS that gets the job done:
    
    .box2
      { font-size: 100%;
        font-family: Verdana;
        color: #000000;
        background: url(images/code_imgs/box_bottom.png) transparent no-repeat bottom left;
        margin: 0;
    	width: 206px;
    	float: left;
        padding-bottom: 8px;
    	min-height: 12em;
        }
    .box2 h1.goomba, .box2 h1.starman
      { background: url(images/code_imgs/goomba_box.png) #693D4C no-repeat top left;
        height: 62px;
        margin: 0;
        padding: 0;
        color: #000000;
        border: none;
        }
    .box2 h1.starman 
      {	background-image: url(images/code_imgs/starman_box.png);
    	}
    .box2 p
      { padding: 0 15px;
        margin: 0 0 10px 0;
        background-color: transparent;
        }
    Code (markup):
     
    KatieK, Oct 11, 2007 IP
  11. le007

    le007 Well-Known Member

    Messages:
    481
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #11
    Hey Katie, thanks for that!!! I'll give it a go!!! :D)
     
    le007, Oct 11, 2007 IP
  12. Scorpiono

    Scorpiono Well-Known Member

    Messages:
    1,330
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    120
    #12
    Use the css for rounded borders or js
     
    Scorpiono, Oct 11, 2007 IP
  13. le_gber

    le_gber Peon

    Messages:
    28
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #13
    You can get a fluid box with rounded corners using css only. All you need to do is relative position the div and absolute position elements inside it (here 3 spans).

    The 2 left corners (top left - tl - ; and bottom left - bl - are small square images of 17px side ; top right is a 400 wide by 17px high img) the last corner (bottom right - br) is a big image of 400px side.

    Here's the code:

    css:

    #box{ position:relative; padding:17px; width:90%; margin:1em auto; background-position:100% 100%; background-repeat:no-repeat; }

    /* ROUNDED CORNERS */
    #box span{ position:absolute; background-repeat:no-repeat; }
    .tl{ top:0; left:0; width:17px; height:17px; background-position:0 0; z-index:3; }
    .tr{ top:0; right:0; width:100%; height:17px; background-position:100% 0; z-index:2; }
    .bl{ bottom:0; left:0; width:17px; height:100%; background-position:0 100%; z-index:1; }

    /* green corner images */
    .gtl{background-image:url("img/gtl.jpg") }
    .gtr{background-image:url("img/gtr.jpg") }
    .gbl{background-image:url("img/gbl.jpg") }
    #box{ background-image:url("img/gbr.jpg"); background-color:#9dcc55; }


    html:

    <div id="box">
    <span class="gtl tl"></span><span class="gtr tr"></span>
    <h2>Services</h2>
    <ul>
    <li><a href="">#</a></li>
    <li><a href="">#</a></li>
    </ul>
    <span class="gbl bl"></span>
    </div>

    live example: http://www.webdesign-fr.com/box.php
     
    le_gber, Oct 11, 2007 IP
  14. le_gber

    le_gber Peon

    Messages:
    28
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #14
    BTW it's been tested and worked in ie7, 6, 5.5 (box less wide), ffox2, opera 9 and netscape 8.3 - if anyone care to try another browser
     
    le_gber, Oct 11, 2007 IP
  15. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #15
    You can do it with some extra containers via CSS, you can do it without extra containers via javascript, or you can be a retard and use a table. Mind you, I am NOT saying don't use tables - just don't use tables for stupid ****

    It can even be done without images
    http://battletech.hopto.org/html_tutorials/rounded_css_borders/

    Some examples of other ways of doing it - the directories these are in are unlocked so you can easily look at the bits and pieces.

    multiple corners using only two images:
    http://battletech.hopto.org/html_tutorials/fourcorners/template.html

    borders AND shadows added via javascript using only one image. (well, there are two images for the whole page, the bottom example uses a different image than the first three)
    http://battletech.hopto.org/html_tutorials/borderimages_javascripted/template.html

    Also, one interested in corners should check out Spanky Corners over on SitePoint - I don't use it myself because it requires four handshakes for the images instead of the one or two my approach uses, but it should work well enough for most people interested in simple corners applied via CSS.

    http://tools.sitepoint.com/spanky/index.php
     
    deathshadow, Oct 12, 2007 IP
  16. Sutocu

    Sutocu Active Member

    Messages:
    938
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    60
    #16
    That's an excellent resource!
     
    Sutocu, Oct 12, 2007 IP
  17. le007

    le007 Well-Known Member

    Messages:
    481
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #17
    Now thats what I was looking for!!! Thanks everyone! le_gber for code and deathshadow for links!
     
    le007, Oct 12, 2007 IP