Hello.I want to ask what is the best way to center all content.For example like this websites www.website.com www.burzum.org. Is the best way to do this is to create <div id="outer"> <div id= "wraper"> content </div> </div> and for css #wraper { 900px;margin:0px auto; } #outer { 960px;margin:0px auto; } So,wraper centers all the content,and outer does a margin for all content outside wraper so that design would look nicer. So,is it the only way to do this?And what about html5 where you don't use divs? Thank you
According to my opinion You don't need two wrappers, I always center my website by using single wrapper: <div id="outer"> Centered content </div> CSS: #outer{margin: 0 auto; width:1024px;} This will center, but if you want to edit the background of wrapper then simply edit the body in CSS Like this: Write in CSS: body{background-color:grey;}
asking people to *like* your comment will get you instantly banned I suggest you read this:https://forums.digitalpoint.com/help/established especially the text in red.
You don't really need an outer div. The standard way of centering content is with a wrapper div that has a width defined and set margin to 0 auto; <div id="wrapper"> <p>Centered content goes here</p> </div> <style type="text/css"> #wrapper{ width:960px; margin:0 auto; } </style> HTML:
Yes,but if i do only one div-wrapper there will be no margin from the left.All the content-images,paragraphs,etc. will be without margin,it will not be centered it will be pushed to the left side
The wrapper div centers in the document window with margin set to auto. 0 defines top and bottom, auto defines left and right. It's just shorter than typing margin:0 auto 0 auto; For HTML5, you still use divs (often). HTML5 introduces new elements to make your documents more symantic (give the search engines more data about your data). You would still use a wrapper div to center your content.
Oh well, that's why padding exists.Margins and paddings are the most used properties to space-out things on the page.As you could tell by now, margin is used for spacing outside of, lets say the div, but paddings on the other hand is used for spacing withing the current element ( div or tag, whatever you may wish ) You can take a look here and get more familiar. http://codepen.io/anon/pen/bIGAv