Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

css questions

Options
  • 09-11-2007 3:06pm
    #1
    Registered Users Posts: 772 ✭✭✭


    just started using css and want to design a web page.tutorials online are great but cant seem to find what im looking for.I basically want to make a file with the menu for the whole website so if i change a menu i wont have to change it on every page.thanks for the help.


Comments

  • Closed Accounts Posts: 7,145 ✭✭✭DonkeyStyle \o/


    It depends on what you want to be able to change about it... css only provides for colour/font/size/etc changes... if you want to be able to change the menu text and urls for the links, then you'll be wanting to research server-side includes.
    Take the html for your menu, stick it in a seperate file... then 'include' it at that location in every page that uses it.


  • Registered Users Posts: 3,594 ✭✭✭forbairt


    As donkey style said ...

    What you might find you want to do is give each page an id in the body as well

    so your homepage would have
    <body id="homepage">
    

    Then in your menu you could have
    <li id="home">
    

    Your css would have ...
    #homepage #home { color: #FF0000; }
    #aboutpage #about { color: #FF0000; }
    

    Then you can nicely color code the page you are on in your menu ...


    A good link for list style menus would be ...
    http://css.maxdesign.com.au/listamatic/


  • Registered Users Posts: 772 ✭✭✭floydmoon1


    i want to be able to change the text
    do you have a link for that server -side stuff
    heres a link to the menu i am thinking of using
    http://www.cssplay.co.uk/menus/final_drop.html


  • Closed Accounts Posts: 7,145 ✭✭✭DonkeyStyle \o/


    floydmoon1 wrote: »
    do you have a link for that server -side stuff
    Not really.
    It depends on what kind of scripting your web-host supports... php, asp (I think there's some dhtml method too, but I haven't dabbled with that in a long time).

    If you've got php support, you can rename your html file to use a .php extension... then try adding (where ever in the html you want your menu to appear):
    <?php @include_once "my_menu.php"; ?>
    Where my_menu.php is the file that contains the html for the menu.
    I haven't looked at the menu, but if it's pure CSS I'd imagine it's mostly <li>'s and <ul>'s for the html... so I don't think it'll get messy.

    Actually, just to point out, you should be using an external style sheet, as opposed to just sticking all the css into the <head> of each page inline.
    Use something like this...
    <head>
    <...>
    <link href="whatever.css" rel="stylesheet" type="text/css">
    </head>
    I'm sure you've seen this already, but I thought it worth mentioning just in case.


  • Registered Users Posts: 772 ✭✭✭floydmoon1


    that was good you mentioned it cause i was just sticking it into every page.im not w web desiigner so just finding stuff out on the net.really just want to make a outline of the website and then give it to a pro to do.thanks for the help i think you have put me on the right track.


  • Advertisement
  • Closed Accounts Posts: 1,200 ✭✭✭louie


    The best way is to built your website is in blocks.
    E.g.
    Header - doesn't require modification very often
    Side-links - same
    Footer - same
    Center - content changes dynamically id db available

    Most content is changing in the center so by having 4 different files you can include them wherever you want when you want, and if any changes are made to one, automatically will be available on the entire website.

    Now all you have to do is include them accordingly:

    E.G. (let's call this page - index.php)
    [php]
    include_once("header.php"); //include header
    include_once("side-links.php");//include left nav

    //center
    include_once("content.php");//content - center of the page
    //or you can have
    echo "<div id='content'>
    some content here - static or dynamic
    </div>";

    include_once("footer.php");//footer
    [/php]

    Now with a bit of programing the content part can change based on your requirements.


Advertisement