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

Website alignment

Options
  • 20-11-2008 1:46am
    #1
    Registered Users Posts: 324 ✭✭


    Hello. Im trying to create a page similar to this. What im interested in is the layout, Im wondering about how to create the alignment seen here, the white portion of the page is the main body and the darker sides expand with the window. I want my page to be aligned in the center like this, with a different colour background. Im using dreamweaver 4, but cant seem to figure it out, I can only set a colour for the entire page.

    I checked out the source code and googled etc, but nothing, any help would be great:pac:


Comments

  • Registered Users Posts: 8,488 ✭✭✭Goodshape


    Haven't a notion about Dreamweaver, but what you're looking for is a fixed-width 'container' div with margin set to auto.

    Like so:
    <body style="background : black;">
      <div style="width : 800px; margin : auto; background : white">
              ALL CONTENT GOES HERE, INSIDE THE DIV.
              PAGE BACKGROUND WILL BE BLACK, CONTENT BACKGROUND WILL BE WHITE.
      </div>
    </body>
    


  • Registered Users Posts: 324 ✭✭greyed


    Ah, nice! Thanks a lot :D


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


    Set yourself free from the dreamweaver shackles IMO.

    Here's how I'd start with it...
    <html>
    <head>
    <style type="text/css">
    body {
    text-align: center;
    margin: 0;
    }
    #blah {
    text-align: left;
    margin: auto;
    width: 700px;
    background: #555;
    }
    </style>
    </head>
    <body>
    <div id="blah">hello<br><br><br><br><br></div>
    </body>
    </html>
    


  • Registered Users Posts: 8,488 ✭✭✭Goodshape


    Donkey -- why text-align : center on the body? Is that useful somewhere? Backwards compatibility?

    (or is it just there out of habbit? ;))


  • Registered Users Posts: 324 ✭✭greyed


    Only started using it for this yoke, surely you dont write everything from scratch?:eek:

    I take it in that code, blah is a label and the div uses those properties?


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


    Goodshape wrote: »
    Donkey -- why text-align : center on the body? Is that useful somewhere? Backwards compatibility?

    (or is it just there out of habbit? ;))
    IE6 ;)


  • Registered Users Posts: 8,488 ✭✭✭Goodshape


    greyed wrote: »
    Only started using it for this yoke, surely you dont write everything from scratch?:eek:
    I do.
    I take it in that code, blah is a label and the div uses those properties?

    DonkeyStyle's code does essentially the same thing as mine. I included the style 'in-line', he separated it out to the top of the page, which is much better practise as it's easier to maintain.

    blah is an id, which can be referenced in the style sheet as #blah.

    Google CSS stylesheets and have a read.


  • Registered Users Posts: 324 ✭✭greyed


    What editors, if any, do you guys use? which is the best?

    /edit, phew impressive, may I ask why?


  • Registered Users Posts: 8,488 ✭✭✭Goodshape


    greyed wrote: »
    What editors, if any, do you guys use? which is the best?
    On Windows I use Crimson Editor.

    Notepad++ is another popular one.


    I know people who use Dreamweaver to write their code and mark-up (html, css, etc.) -- ignoring the visual WYSIWYG aspects of it. Always seemed like over-kill to me though.


    Why I code it 'by hand'.... more control over the end result, better structured and nicer code (makes more of a difference than you might think - particularly when doing updates further down the line) and once you learn the basics of what you want to do I dare-say it's quicker too. No fiddling about in menus and options and bullsh*t... just hands on keyboard, writing no more than I need to.


  • Registered Users Posts: 3,057 ✭✭✭kjt


    greyed wrote: »
    What editors, if any, do you guys use? which is the best?

    /edit, phew impressive, may I ask why?

    Notepad is the best thing to learn in from scratch, or notepad++. Once you know how to code you could move on to dreamweaver so your not skipping steps and missing the vital mistakes you SHOULD be making at the start :)


  • Advertisement
  • Registered Users Posts: 324 ✭✭greyed


    I like notepad++ alright. Ive done stuff from scratch before, both in college and before it, nothing too complex though. So I understand the code it generates for the most part. Why do you not like the WYSISYG approach goodshape?


  • Registered Users Posts: 8,488 ✭✭✭Goodshape


    greyed wrote: »
    Why do you not like the WYSISYG approach goodshape?

    Not sure if you saw my edited-in explanation in the last post? ;)

    Main reason would be that I prefer to have full control over the end result, and the less time using a mouse the better (I can type fast... hate having to break away to find my mouse and access some menu when I could just be typing "color : black;".


  • Registered Users Posts: 324 ✭✭greyed


    Ah, nope, didnt see that:D Sounds reasonable.
    Thanks again for help all.


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


    What editors, if any, do you guys use? which is the best?
    Notepad++ here.
    I started off with dreamweaver when I didn't know any html, we generated some hideous html together... empty font tags ftw :pac:
    Once I learned how to actually write html/css I just never felt the need to go back.
    Notepad++ open in one window, Firefox/IE open in another... refresh the browser when you want to see an update... not sure what I'd want wysiwyg for.
    I'm pretty much on the same page as Goodshape with this... there isn't really that much typing involved... especially once you start dumping your CSS out to an external stylesheet and re-using it across the whole site.
    Goodshape wrote: »
    DonkeyStyle's code does essentially the same thing as mine.
    *cough* except it works in IE6 :pac: :D


  • Registered Users Posts: 324 ✭✭greyed


    we generated some hideous html together...

    :D


Advertisement