HTML help

  • Thread starter robert1
  • 9 comments
  • 562 views
603
United Kingdom
England, Kent
Robertjh90903
hey, its been a while since ive done any HTML, but started to make a portfolio. and theres just one thing I'm completely blanking on. and that's the padding? (maybe) on either side, for example this website has the content in the center with even amount of grey either side. this is what I'm looking to do. ive done it before but I just cant think how or even what its called. any help is appreciated! I will message back if I work it out myself, and give a solution for anyone in the future.

but if you know before I do, thank you in advance! :P
 
hey, its been a while since ive done any HTML, but started to make a portfolio. and theres just one thing I'm completely blanking on. and that's the padding? (maybe) on either side, for example this website has the content in the center with even amount of grey either side. this is what I'm looking to do. ive done it before but I just cant think how or even what its called. any help is appreciated! I will message back if I work it out myself, and give a solution for anyone in the future.

but if you know before I do, thank you in advance! :P

<div align="center">
 
Something like this will do the trick:

<div id='contentWrapper'>
</div>


and in css:

#contentWrapper {
width: 1000px;
margin: auto;
}

yes! that's it :P thank you, was even looking through old work ive done and couldn't find it
 
That answer is the basics of it but if you want to get into things properly you're going to want to be looking at responsive grid frameworks. Mobile traffic is huge these days and only growing, you should be accomdating for them. To get started with the very basics change that CSS to 'max-width' instead of just width and resize your browser window, see how it affects things inside it. Then go from there, looking into media queries.

<div align="center">

The align attribute is deprecated and not supported in HTML5.
 
That answer is the basics of it but if you want to get into things properly you're going to want to be looking at responsive grid frameworks. Mobile traffic is huge these days and only growing, you should be accomdating for them. To get started with the very basics change that CSS to 'max-width' instead of just width and resize your browser window, see how it affects things inside it. Then go from there, looking into media queries.



The align attribute is deprecated and not supported in HTML5.


thank you, did do that for what we had to do in university but then just didn't touch html / css for over a year now so just forgot a lot, but thank you! slowly re learning :P
 
Another way to center something would be with a Flexbox, it's the easiest for me personally. But like everything in HTML/CSS, it all depends on what you're trying to make.
 
Another way to center something would be with a Flexbox, it's the easiest for me personally. But like everything in HTML/CSS, it all depends on what you're trying to make.

Flexbox is great but no good if you still need to support the devil that is IE.
 
Back