Search code examples
htmlcentering

is it possible to center an already prefixed webpage?


Is there anyway to overall centre a webpage that already has fixed values? I personally wouldn't have thought so, but I've spent a lot of time making a layout I'm happy with and now to centre it, it's all going to have to be rewritten. Is there any way at all to in case and centre pre-written code? Like a table? Sorry, if this is an uneducated question pretty new to code.

Any guidance or direction would be great

This what I'm after, which is currently all fixed to the left:

enter image description here


Solution

  • You could try putting it inside a wrapper with a fixed width and left and right margins set to auto:

    #wrapper {
        width: 700px;
        margin:0 auto;
    }
    
    <div id="wrapper">
      <!-- your content goes here -->
    </div>