Not signed in (Sign In)

SkillShare - A place to discuss Web Standards and Web Design topics

Categories

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorJez
    • CommentTimeJun 20th 2006
     permalink
    I am trying to create the below in css, and am stuck. Have been reading up about it cause i am just starting to learn layout in css.
    I have a #nav div and then inside that i had the names of buttons but i don't know how to make them individual different colours. They dont even really need to be a roll over, just a button.
    I just cannot get them in a nice row with their own colour.

    • CommentAuthorseedee
    • CommentTimeJun 20th 2006
     permalink
    put a class on every button and in css you just change the color for every class ..

    Cheers!
    •  
      CommentAuthorcola
    • CommentTimeJun 20th 2006
     permalink
    Instead of re-writing your first class, have 2 classes on each box. One that defines the layout and one that defines colour. It's makes managing classes and updating content far easier.

    For example, just say your box div class is called "topbox" , then having creating your colour classes, your code would look like this...
    <div class="wrapper">
    <div class="topbox orange">
    Home
    </div>
    <div class="topbox green">
    Products
    </div>
    <div class="topbox blue">
    Fees
    </div>
    <div class="topbox purple">
    Calculator
    </div>
    <div class="topbox red">
    Contact
    </div>
    </div>

    ie where colour classes are
    div.red {background:#ff0000; color:#ffffff;}
    div.green {background:#00ffff; color:#ffffff;} etc etc
  1.  permalink
    You shouldn't even need to specify "topbox" each time. For semantic purposes, you should make each button an anchor tag within a list item, and then specify something like:

    ul.nav {
    margin: 0px;
    padding: 0px;
    }

    ul.nav li {
    display:inline;
    margin:0px;
    padding:0px;
    }

    .nav a {
    height: 20px;
    border-right: 1px solid #FFF;
    display: block;
    float: left;
    }

    .nav .purple {
    background: #369
    }


    And for your markup:

    <ul class="nav">
    <li><a class="purple">Whatever</a></li>
    </ul>


    And so on.
  2.  permalink
    Darren wins the efficient markup award for the day.
    • CommentAuthorJez
    • CommentTimeJun 20th 2006
     permalink
    Thanks guys very much appreciated. I am still learning all this so is pretty new to me. But i will go through and try get your suggestions working.

    Thanks again :)
    • CommentAuthorJez
    • CommentTimeJun 20th 2006
     permalink
    Right gave it a go with playing around using bits and bobs, looks great in DW however, when i upload it nothing is there apart from a few lines.

    Here is the css

    #nav {
    height: 20px;
    width: 780px;
    }
    #topnav {
    width: 780px;
    height: 20px;
    }
    /* Navigation */
    #nav1 {
    background-color: F08A05;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    height: 20px;
    width: 1px;
    }

    #nav1 a {
    padding:8px 15px;
    margin:0px;
    font-weight:bold;
    display:block;
    color:#fff;
    text-decoration:none;
    float:left;
    height:12px;
    border-top: 0px;

    }
    #nav2 {
    background-color: 278741;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    height: 20px;
    width: 1px;
    float: left;
    }
    #nav2 a {
    padding:8px 15px;
    margin:0px;
    font-weight:bold;
    display:block;
    color:#fff;
    text-decoration:none;
    float:left;
    height:12px;
    border-top: 0px;

    }
    #nav3 {
    background-color: #468FCC;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    height: 20px;
    width: 1px;
    float: left;
    }
    #nav3 a {
    padding:8px 15px;
    margin:0px;
    font-weight:bold;
    display:block;
    color:#fff;
    text-decoration:none;
    float:left;
    height:12px;
    border-top: 0px;

    }
    #nav4 {
    background-color: #6D4D9F;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    height: 20px;
    width: 1px;
    float: left;
    }
    #nav4 a {
    padding:8px 15px;
    margin:0px;
    font-weight:bold;
    display:block;
    color:#fff;
    text-decoration:none;
    float:left;
    height:12px;
    border-top: 0px;

    }
    #nav5 {
    background-color: #EE4307;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    height: 20px;
    width: 1px;
    float: left;
    }
    #nav5 a {
    padding:8px 15px;
    margin:0px;
    font-weight:bold;
    display:block;
    color:#fff;
    text-decoration:none;
    float:left;
    height:12px;
    border-top: 0px;

    }

    The nav1 nav2 etc being each button. As i said looks fine in DW when online though nothing there at all really.
  3.  permalink
    What does "nothing is there" mean? Do you have an example URL?

    Make sure you're linking to the style sheet.
    • CommentAuthorJez
    • CommentTimeJun 20th 2006
     permalink
    Here is a link http://www.homeletfinance.co.uk/nav.php i mean as in nothing is there just a few lines :(
  4.  permalink
    Hi!

    Firstable get rid of all divs this is not a CSS way. It's a bad way of using DIVS and pretty much the same as using tables.
    Use UL LI as Darren said create a Class for each next LI block.

    Cheers, DS
    • CommentAuthormdz61384
    • CommentTimeJun 20th 2006
     permalink
    hey Jez,

    I took a look at your css file and made some adjustments, for you to use or ignore, your choice:

    ---------------------------------------------------------------------------
    #nav, #topnav {
    height: 20px;
    width: 780px;
    }

    /*___________________ Navigation ___________________*/
    #nav1, #nav2, #nav3, #nav4, #nav5 {
    float: left;
    height: 20px;
    width: 1px;
    background: #F08A05;
    font: normal 11px Arial, Helvetica, sans-serif;
    }
    #nav1 {float: none;}
    #nav2 {background: #278741;}
    #nav3 {background: #468FCC;}
    #nav4 {background: #6D4D9F;}
    #nav5 {background: #EE4307;}

    #nav1 a, #nav2 a, #nav3 a, #nav4 a, #nav5 a {
    float: left;
    display: block;
    height: 12px;
    font-weight: bold;
    color: #fff;
    text-decoration: none;
    margin: 0;
    padding: 8px 15px;
    border-top: 0;
    }
    --------------------------------------------------------------------------

    okay so what the hell did I do:

    - there were a lot of repeats for code. whats nice is that you can "combine" id's and classes that share similar traits, only to respecify the differences later. all of your non-link nav id's had the same traits, and the different ones are indented and re-specified after the properties the "group" shares. I hope this makes sense, and it shortens your code significantly, down to 30 lines, or more if you make additional enhancements. (ask if you'd like them)

    some questions I had when I looked at this:

    - is there a reason you don't have float: left; on your #nav1 input? the rest of them do?
    - some of your background color hex values didn't have pound signs(#) so I added them
    - on a personal note, I usually arrange my css in a specific order, with positioning and height/width attributes always coming first, as in my code they usually are the culprit and ones I'll have to edit first.
    - indentation is awesome in css, especially if you have multiple selectors within a container (.div, .div a, .div a strong, etc). keeps them organized and its almost like cascading tags for css :)
    - I use the "background" property personally no matter whether I use shorthand background (color, image link, positioning, yadda yadda) or just a color. easier for me to read, but *may* not be 'semantically' correct.

    yeah so I hope this helps. don't want to be overstepping my bounds when I'm so new here :o)
    • CommentAuthorJez
    • CommentTimeJun 20th 2006
     permalink
    Thanks Mdz, i have changed to your css and agree its a better way, as i said am still learning what is best to do.

    DS, thanks for your comment, i am still learning and it is all new for me. Should i not use divs at all? I have just been plodding along trying to get my head round it all.

    Oh Mdz i uploaded your css and its still not appearing like i see it in DW :s

    Thanks again guys for your comments
    • CommentAuthormdz61384
    • CommentTimeJun 20th 2006
     permalink
    I should have asked what version of Dreamweaver you are using. That's very important to see how it ends up displaying, as Dreamweaver can be a picky pain in the arse sometimes. Care to provide that? I'll also look at your test page tomorrow and see if I can whip up something real quick for you. I know you are learning...the web world is big, bad and scary. I'm still learning. We all are.

    Most of the time with horizontal navigation lists, you'd use an unordered list, remove the bullets, and each list item would be a block, while the UL tag would enclose the whole thing. search on A List Apart, they have some very good links

    Keep up the good work
    • CommentAuthorJez
    • CommentTimeJun 21st 2006
     permalink
    Thanks md, i am using Dreamweaver 8 think it is the most recent one.

    Right in future i will try and figure out the list with ul and il etc once i have learnt that hopefully i will know how to do that problem and on to the next one.

    Cheers :)
  5.  permalink
    Hi Jez!

    You can't really rely on DW to display page correctly in a Design mode.
    Most of time CSS design is broken in DW.
    If you trying to use WYSIWYG for CSS it will not work with DW or any other software on a market. You have to switch to Code mode. 80% when I using DW i'm in code mode. It's doesn't really matter how it looks in DW. What really counts how it looks in a browser.

    Cheers, DS
    • CommentAuthorJez
    • CommentTimeJun 22nd 2006
     permalink
    Thanks dm, i am only really use DW though.

    Thats why i uploaded to check and obviously cannot see.

    However, i don't know where to start in regard to why it is not showing up.
Add your comments
    Username Password
  • Format comments as (Help)