HTML Website design

by 23 replies
26
Hey Guys, I am teaching myself HTML and CSS. I am using Adobe Dreamweaver to make a website. I have just created the layout using div tags however, I want to centre the entire layout. How do I go about doing this? If I use the centre tag, It centres the content however, I want to centre the layout instead. I hope this makes sense.
#website design #design #html #layout #website
  • you can use margin: 0 auto;
    • [1] reply
    • Very nice and i think you need to visit this site w3school.com this will become very helpful for you and try margin : 0 may be you will get solution of your problem.
  • It's a bit difficult to tell exactly what you are asking, without an example. Nevertheless, I'm going to guess that you want your current web page as it is, but you want it centered on the page (as opposed to left aligned, or something of the like).

    Now, a simple, if unelegant way to perhaps solve this problem would be to, well, encapsulate the contents of the site body within yet another div tag, and set the alignment of this div tag's content to "center", thereby center aligning the whole page.

    However, this might mess around with the relative positionings of your site elements (again, hard to know without an example), but if this proves to be the case, you could try removing the center align attribute from the div tag added earlier, and then nest that within another div tag, with the alignment set to "center". That way, the relative positionings within the inner div tag (containing site contents) should be preserved, and this div tag itself would then be center aligned by the outermost one, effectively center aligning the whole page.

    I'm sure there are better ways to do this, but its just the first solution that jumped into my head. I'd suggest just giving it a try anyway, and seeing if it gives you the effect you desired. I hope that helps.
  • make #Wrapper div and take all divs into Wrapper.
    #wrapper{margin:0px auto;}
    or text-align:center
  • you can visit w3schools.com

    It has answers to all your html,css related questions.
  • margin:0 auto; is good, the main wrapper will be center for sure... good luck!
  • You can find the solution of your problem from this site... "webdesign(dot)about(dot)com/od/css/ht/htcsscenterfix(dot)htm"
  • Banned
    [DELETED]
  • Banned
    [DELETED]
  • It's a bit difficult to tell exactly what you are asking, without an example. Nevertheless, I'm going to guess that you want your current web page as it is, but you want it centered on the page.
  • [DELETED]
  • [DELETED]
  • Banned
    [DELETED]
  • [DELETED]
  • Body include all website so you can write that


    *{margin: 0 auto ; padding :auto;}
    body{margin 0 auto;}
  • create a new file...
    Make this div and add this css.
    You will be able to see how it works.

    body {
    margin:50px 0px; padding:0px;
    text-align:center;
    }

    #Content {
    width:500px;
    margin:0px auto;
    text-align:left;
    padding:15px;
    border:1px dashed #333;
    background-color:#eee;
    }
  • Banned
    [DELETED]
  • another tip be sure you want to check out the site that you are designing in a tableless manner or CSS in IE because IE is not really cooperating well with CSS ...
  • My favorite way to accomplish absolute centering is ...

    For a div that is, say, 800 px wide:

    #someDiv{

    left: 50%;
    margin-left: -400px;

    }

    I don't remember how I got hooked on this method, but at some point using Auto margins failed me and I discovered this method and have used it ever since.

    -Phil
  • You can insert the css inside the page in somewhere between the <head> </head> tags like this:

    <style type="text/css">
    body {
    text-align: center;
    }

    #container {
    margin: 0 auto;
    width:
    }
    </style>


    Your html structure has to go something like this:

    <body>
    <div id="container">
    Your others DIVs or content, hope I've been of help, Godspeed!
    </div>
    </body>
  • w3school is only the right place to know more about this issues.
    • [1] reply
    • html and css is the main source for designing website its nice to know that here is forum about this stuff its can really add me a knowledge about HTML and css that i can apply on my professional website design
  • Read tutorials on w3schools. For html and css
  • You can find help for your problem from:

    codeassembly.com/How-to-center-a-page-layout

    Hope it will be helpful to you...
  • Banned
    [DELETED]
  • [DELETED]
  • May I also suggest using no tables just use pure CSS.
  • You must start using notepad ++ it will let u write all codes and from tht u will learn codes too
  • Banned
    [DELETED]
  • The most common approach to creating a website with Dream-weaver is to create and edit pages on your local drive, and then upload copies of those pages to a remote web server for viewing on the web.
  • You can learn more about HTML and others languages through w3school.com.
  • Another cool way to center a div ... is this method
    In the html page "example.html" you have ths div :
    <div class="centerme" >Center div</div>
    And in the css file put this :
    .centerme
    {
    width:800px; /*Your div width*/
    margin-left:auto;
    margin-right:auto;
    }
  • [DELETED]
  • Banned
    [DELETED]
  • [DELETED]
  • Banned
    [DELETED]
  • Banned
    [DELETED]
  • Banned
    [DELETED]
  • [DELETED]
  • [DELETED]
  • [DELETED]
  • [DELETED]
  • [DELETED]

Next Topics on Trending Feed

  • 26

    Hey Guys, I am teaching myself HTML and CSS. I am using Adobe Dreamweaver to make a website. I have just created the layout using div tags however, I want to centre the entire layout. How do I go about doing this? If I use the centre tag, It centres the content however, I want to centre the layout instead. I hope this makes sense.