How To Centre a div On a PageTo centre a div on a page, you apply the following CSS to it: { Note, the above is a CSS shorthand, where the 0 sets the top and bottom margin, 0 in this case, and the auto sets the left and right margin. The auto tells the browser to automatically set the left and right margin, splitting the space evenly and thus centering the div in the browser window. We could equally have written: { See Example 1 for a worked example. The full page code is: <!doctype html> <style> #container </style> </head> <body> <div id="container"> </body> </html>
Visit LowPrices.co.uk for Your UK Shopping
|
|
All Content ©2020 WebRef.eu |