a webpage?
I need some help ive searched but I dont know what code to put in and where!
Printable View
a webpage?
I need some help ive searched but I dont know what code to put in and where!
Depends on what you want to center. If it's text then you should be centering the p element in css. If it's a block element, there's a number of ways to do it.
it was centering the entire webpage but I managed to figure it out :D
You can always use <center> </center> or what I like to do is, make a <div> with a defined width, then set its left 50%. This will bring the top left corner of the div to be centered on the page width wise. Then just set margin-left to -[half of the width of the div] For example, if my div was 900px wide, I would set the margin-left to -450px.
Another way (my personal favorite) if you are wanting to center a container div, you can use margin-left:auto and margin-right: auto. This only works horizontally, but most of my work spans the whole page lengthwise, so I don't really have to worry about it. The auto trick seems to be pretty cross-browser compatible as well.
okay cool :]
Try to use CSS for all the formatting for a webpage and to center a webpage <div> tag is a best option to use with align as a center.....
Try not to use <center> if you want to keep up with modern times.
Straight after the <body> tag, its best to enter a <div id="container"> tag, and then close the tag just before the body tag is closed. Using CSS you can center all of the content on the page by using this:
Code:#container {margin:0 auto;}