+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Rounded corner Boxes in CSS

  1. #1
    digitalimages is offline x10Hosting Member digitalimages is an unknown quantity at this point
    Join Date
    Feb 2009
    Posts
    47

    Rounded corner Boxes in CSS

    I have been working on a custom 404 page for my site which would be a consistant style similar to the rest of my site. I can do this but then I started playing with using CSS for creating a box with rounded corners like here:
    http://digitalimages.x10hosting.com/new404.htm
    but as you can see one corner is not in the right place and also I'm not sure how to move the box to the center of the page. :dunno:
    The CSS for the box is below: (not my code)
    Suggestions for getting that floating corner in the right position and for centering the entire box would be appreciated.
    Thanks,
    wp

    .dialog {

    margin:0px auto;
    min-width:8em;
    max-width:640px;
    color:#fff;
    z-index:1;
    margin-left:12px;
    margin-bottom:0.5em;
    }

    .dialog .content,
    .dialog .t,
    .dialog .b,
    .dialog .b div {
    background:transparent url(dialog2-blue-800x1600.png) no-repeat top right;
    _background-image:url(dialog2-blue.gif);
    }

    .dialog .content {
    position:relative;
    zoom:1;
    _overflow-y:hidden;
    padding:10px 12px 10px 10px;
    }

    .dialog .t {
    /* top+left vertical slice */
    position:absolute;
    left:0px;
    top:0px;
    width:12px; /* top slice width */
    margin-left:-12px;
    height:100%;
    _height:1600px; /* arbitrary long height, IE 6 */
    background-position:top left;
    }

    .dialog .b {

    position:relative;
    width:100%;
    }

    .dialog .b,
    .dialog .b div {
    height:30px;
    font-size:1px;
    }

    .dialog .b {
    background-position:bottom right;
    }

    .dialog .b div {
    position:relative;
    width:12px;
    margin-left:-12px;
    background-position:bottom left;
    }

    .dialog .hd,
    .dialog .bd,
    .dialog .ft {
    position:relative;
    }

    .dialog .wrapper {

    position:static;
    max-height:1000px;
    overflow:auto;
    }

    .dialog h1,
    .dialog p {
    margin:0px;
    padding:0.5em 0px 0.5em 0px;
    }

    .dialog h1 {
    padding-bottom:0px;
    text-align: center;
    }



    a:link { color: #ffffff; text-decoration: none; }

    a:visited { color: #ffffff; text-decoration: none; }

    a:active { color: #808080; text-decoration: none; }

    a:hover {
    color: #000000;
    text-decoration: none;
    font-family: Arial;
    font-size: 15px;

  2. #2
    mfurqanabid's Avatar
    mfurqanabid is offline x10Hosting Member mfurqanabid is an unknown quantity at this point
    Join Date
    Mar 2008
    Posts
    37

    Re: Rounded corner Boxes in CSS

    Use the following code in CSS

    .element {
    border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px;
    }
    Muhammad Furqan

    Visit knowledge Hut for programming help.

  3. #3
    Anna's Avatar
    Anna is offline I am just me Anna is a name known to allAnna is a name known to all
    Join Date
    Aug 2007
    Location
    Sweden
    Posts
    6,569

    Re: Rounded corner Boxes in CSS

    that is not supported by older browser though, but it is the easiest way to make rounded corners.

  4. #4
    freecrm's Avatar
    freecrm is offline x10 Elder freecrm is an unknown quantity at this point
    Join Date
    May 2008
    Location
    UK
    Posts
    629

    Re: Rounded corner Boxes in CSS

    I have to admit, after about 1/2 hour trying to understand the mixed up html and alternative css, I am at a loss!

    Also where is his element class????:dunno:

    to get your object to center, you would usually set margins as follows:

    .dialog{
    margin: 10px auto 10px auto;
    width: 600px; /*or whatever*/
    }

    I'm fascinated to see how the images in your css are used for this so I'll be keeping a close eye on this thread.

    I can do rounded corners - but not like this!

  5. #5
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Rounded corner Boxes in CSS

    It's the align="center" on a containing <td> that's causing the corner to center. I hope you're in the process of replacing the tables with semantic HTML and CSS. After that, you can center the rounded rectangle.

    A problem like this is a great subject for a minimal test case, which will help you narrow down on the problem. You can also use Firebug to easily alter the document structure and styling in an attempt to fix the layout.
    Last edited by misson; 04-23-2009 at 12:19 PM. Reason: added advice for debugging in the future

  6. #6
    Teensweb is offline x10 Lieutenant Teensweb is an unknown quantity at this point
    Join Date
    May 2008
    Posts
    352

    Re: Rounded corner Boxes in CSS

    Can you post the html too?

  7. #7
    digitalimages is offline x10Hosting Member digitalimages is an unknown quantity at this point
    Join Date
    Feb 2009
    Posts
    47

    Re: Rounded corner Boxes in CSS

    Thanks for the replies and yes I am aware that the code is a mess. I will attempt to correct this if I ever use this. I was just trying to get this to work and view corectly at least in Firefox.
    http://digitalimages.x10hosting.com/new404x.htm
    this is the revised version...which seems to have things in place. On a larger 22" screen the box is still on the left side of the screen but on a 17" it is close to the middle.
    For teensweb just do a right click on the page and view the source code form there or go to view and select "page source" in Firefox or "source" in IE
    wp

  8. #8
    freecrm's Avatar
    freecrm is offline x10 Elder freecrm is an unknown quantity at this point
    Join Date
    May 2008
    Location
    UK
    Posts
    629

    Re: Rounded corner Boxes in CSS

    I've had a quick look at your revised page (IE7) and the box is about 10-20 px from the right... In addition, the bacground to your corners are white! arrgh.

    FF is working fine and centered (1024x76

    Chrome is also working well.

    I have noticed that all versions, when re-sizing the window, have a fixed left margin, so however you alter this value, it will never be right for all browsers, which is why I suggested the margin: auto technique.

    By the way, if you want to test your site on multiple browsers, check out browsershots.org

  9. #9
    mfurqanabid's Avatar
    mfurqanabid is offline x10Hosting Member mfurqanabid is an unknown quantity at this point
    Join Date
    Mar 2008
    Posts
    37

    Re: Rounded corner Boxes in CSS

    YOu can also make a round corners for old browsers line ie6 using javascript libraries

    View: http://www.phatfusion.net/roundedcorners/index.htm
    Muhammad Furqan

    Visit knowledge Hut for programming help.

  10. #10
    digitalimages is offline x10Hosting Member digitalimages is an unknown quantity at this point
    Join Date
    Feb 2009
    Posts
    47

    Re: Rounded corner Boxes in CSS

    I fixed the margins:auto and at least it displays ok in Firefox. Still IE7 is a mess.

    http://digitalimages.x10hosting.com/new404.htm

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. html rounded borders and IE
    By Ixonal in forum Programming Help
    Replies: 9
    Last Post: 10-11-2008, 04:43 PM
  2. Top-Left Corner
    By MarioMaster in forum Graphics & Webdesign
    Replies: 1
    Last Post: 08-03-2008, 03:36 PM
  3. Rounded Corners
    By themasterrocker in forum Programming Help
    Replies: 18
    Last Post: 06-02-2008, 12:04 PM
  4. Create Rounded forms in html
    By anuj_web in forum Programming Help
    Replies: 9
    Last Post: 04-12-2008, 07:06 AM
  5. REQ: Rounded Corners
    By Chris Z in forum The Marketplace
    Replies: 4
    Last Post: 04-23-2007, 05:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers