473,406 Members | 2,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Centering CSS

I want to center the entire site, incase people have wide screen monitors. I'm suspecting it has something to do with the position being absolute but I dunno. I've been trying everything, so there might be some uneeded script. Heres the code:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <style type="text/css">
  3.  
  4. body {
  5.  
  6.  
  7. margin-top:0px;
  8. margin-bottom:0px;
  9. margin-left:0px;
  10. height:auto;
  11. text-align:center;
  12.  
  13.  
  14. }
  15.  
  16. P.wood { 
  17.    text-align: center;
  18.   }
  19.  
  20. div.all{
  21.    margin-left: auto;
  22.    margin-right: auto;
  23. }
  24. </style>
  25.  
  26.  
  27. </head>
  28. <body  bgcolor="black">
  29.  
  30. <DIV style="text-align:center;position: absolute; top:0px; left:0px; width:113px; height:0px">
  31. <DIV style="position: absolute; top:0px; left:437px; width:100px; height:15px;">
  32.     <table>
  33.       <tr>
  34.            <td><img src="abbadontitle.jpg" alt="About Us Pic" name="aboutus">
  35.  
  36.         </td>
  37.       </tr>
  38.     </table>
  39.   </DIV>
  40.  
  41. <DIV style="position: absolute; top:30px; left:42px; width:100px; height:15px;">
  42.     <table>
  43.       <tr>
  44.           <td><img src="mikefade4.jpg" alt="Our Services pic" name="ourservices">
  45.  
  46.         </td>
  47.       </tr>
  48.     </table>
  49.   </DIV>
  50.  
  51. <DIV style="position: absolute; top:20px; left:375px; width:100px; height:15px;">
  52.     <table>
  53.       <tr>
  54.         <td><img src="movietitle3.jpg" alt="Contact Us Pic" name="contactus">
  55.  
  56.         </td>
  57.       </tr>
  58.     </table>
  59.   </DIV>
  60.  
  61. <DIV style="position: absolute; top:0px; left:0px; width:00px; height:15px;">
  62.     <table>
  63.       <tr>
  64.         <td><img src="rightfilm.jpg" alt="Contact Us Pic" name="contactus">
  65.  
  66.         </td>
  67.       </tr>
  68.     </table>
  69.   </DIV>
  70.  
  71. <DIV style="position: absolute; top:0px; left:967px; width:00px; height:15px;">
  72.     <table>
  73.       <tr>
  74.         <td><img src="rightfilm.jpg" alt="Contact Us Pic" name="contactus">
  75.  
  76.         </td>
  77.       </tr>
  78.     </table>
  79.   </DIV>
  80.  
  81. <DIV style="position: absolute; top:700px; left:0px; width:00px; height:15px;">
  82.     <table>
  83.       <tr>
  84.         <td><img src="bottom.jpg" alt="Contact Us Pic" name="contactus">
  85.  
  86.         </td>
  87.       </tr>
  88.     </table>
  89.   </DIV>
  90.  
  91. <div style="position: absolute; top:300px; left:300px; width:0px; height:0px;">
  92.     <table>
  93.       <tr>
  94.         <td><object><param name="allowfullscreen" value="true" >
  95. <param name="allowscriptaccess" value="always" >
  96. <param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=890103&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1">
  97. <embed src="http://www.vimeo.com/moogaloop.swf?clip_id=890103&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1"
  98.  type="application/x-shockwave-flash" 
  99. allowfullscreen="true" allowscriptaccess="always" width="400" height="240">
  100. </embed>
  101. </object>
  102.         </td>
  103.       </tr>
  104.     </table>
  105.   </DIV>
  106. </DIV>
  107.  
  108.  
  109.  
  110.  
  111. </body>
  112.  
Jun 27 '08 #1
3 1271
AricC
1,892 Expert 1GB
Here's a link:

center
Jun 27 '08 #2
I added the text-align:center; to the body selector and the margin: 0 auto to the container and it still won't work... i'll add the code:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <head>
  3.  
  4. <style type="text/css">
  5.  
  6. body {
  7.        text-align:center;
  8.        background-color: black;
  9.         }
  10.  
  11. #container {
  12.     margin: 0 auto;   /* align for good browsers */
  13.     text-align: left; /* counter the body center */
  14.  
  15. </style>
  16.  
  17.  
  18. </head>
  19. <body>
  20.  
  21. <DIV id="container">
  22. <DIV style="position: absolute; top:0px; left:437px; width:100px; height:15px;">
  23.     <table>
  24.       <tr>
  25.            <td><img src="abbadontitle.jpg" alt="About Us Pic" name="aboutus">
  26.  
  27.         </td>
  28.       </tr>
  29.     </table>
  30.   </DIV>
  31.  
  32. <DIV style="position: absolute; top:30px; left:42px; width:100px; height:15px;">
  33.     <table>
  34.       <tr>
  35.           <td><img src="mikefade4.jpg" alt="Our Services pic" name="ourservices">
  36.  
  37.         </td>
  38.       </tr>
  39.     </table>
  40.   </DIV>
  41.  
  42. <DIV style="position: absolute; top:20px; left:375px; width:100px; height:15px;">
  43.     <table>
  44.       <tr>
  45.         <td><img src="movietitle3.jpg" alt="Contact Us Pic" name="contactus">
  46.  
  47.         </td>
  48.       </tr>
  49.     </table>
  50.   </DIV>
  51.  
  52. <DIV style="position: absolute; top:0px; left:0px; width:00px; height:15px;">
  53.     <table>
  54.       <tr>
  55.         <td><img src="rightfilm.jpg" alt="Contact Us Pic" name="contactus">
  56.  
  57.         </td>
  58.       </tr>
  59.     </table>
  60.   </DIV>
  61.  
  62. <DIV style="position: absolute; top:0px; left:967px; width:00px; height:15px;">
  63.     <table>
  64.       <tr>
  65.         <td><img src="rightfilm.jpg" alt="Contact Us Pic" name="contactus">
  66.  
  67.         </td>
  68.       </tr>
  69.     </table>
  70.   </DIV>
  71.  
  72. <DIV style="position: absolute; top:700px; left:0px; width:00px; height:15px;">
  73.     <table>
  74.       <tr>
  75.         <td><img src="bottom.jpg" alt="Contact Us Pic" name="contactus">
  76.  
  77.         </td>
  78.       </tr>
  79.     </table>
  80.   </DIV>
  81.  
  82. <div style="position: absolute; top:300px; left:300px; width:0px; height:0px;">
  83.     <table>
  84.       <tr>
  85.         <td><object><param name="allowfullscreen" value="true" >
  86. <param name="allowscriptaccess" value="always" >
  87. <param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=890103&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1">
  88. <embed src="http://www.vimeo.com/moogaloop.swf?clip_id=890103&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1"
  89.  type="application/x-shockwave-flash" 
  90. allowfullscreen="true" allowscriptaccess="always" width="400" height="240">
  91. </embed>
  92. </object>
  93.         </td>
  94.       </tr>
  95.     </table>
  96.   </DIV>
  97. </DIV>
  98.  
  99.  
  100.  
  101.  
  102. </body>
  103.  
  104.  
Jun 27 '08 #3
actually it does seem to display correctly for me on IE7 and FF ...
the embeded video is centered at least . . .


one suggestion: if you want your other divs to display in the right or left corner, you should probably FLOAT them there instead of using absolute coordinates. right now they slightly exceed the width of my monitor set at 1024 x 768...

FLOAT will position the tags properly on wide & hi-res screens as well as for the poor sops using 800x600.
Jun 29 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Jeff Thies | last post by:
I have a series of blocks that are float left that I need centered on the page. <div class="center" align="center"> <div style="width: 100 px;float: left">thumbnail 1</div> <div style="width:...
6
by: Fran¨ois de Dardel | last post by:
http://mapage.noos.fr/dardelf3/tintin/page3bits.html Can I center the series of thumbnails horizontally in the pages _and_ keep the "elastic arrangement" where the number of thumbnails adapts to...
3
by: Jonah Bishop | last post by:
I have a puzzling problem with centering text, and I'm hoping that someone here can help me out. First of all, let me state that I am using XHTML 1.0 Strict and CSS for all layout purposes (no...
2
by: Ryan W Sims | last post by:
I'm having trouble with centering in IE... http://www.ryanwsims.com/koh/ The image should center over the text. It does in Firebird, but not in IE for some reason. If you look at ...
9
by: Pierre Jelenc | last post by:
Is there a way to center (horizontally) a UL list of unknown width? I can put it in a DIV that's centered with "margin-left: auto; margin-right: auto;" but I then have to specify a width; otherwise...
15
by: red | last post by:
How do I center two side by side divs ? I've been writing css pages for a while but there's one thing tha still eludes me. I can center a div with margin auto. I can place two divs side by side...
6
by: Axel Siebenwirth | last post by:
Hi, as described at http://www.quirksmode.org/css/centering.html, I try to do to centering with my site. I did exactly as told on that page but it only seems to center horizontally. My site...
3
by: John Pote | last post by:
1. Horizontal centering a <divin browser window. The current trend seems to be to place page content in a fixed width area in the middle of the browser window. How is this achieved? If I use a...
5
by: Markus Ernst | last post by:
Hello This is a test example: http://www.markusernst.ch/anthracite/ http://www.markusernst.ch/anthracite/living_divani.html After googling and experimenting for several hours, I ended up...
1
by: =?Utf-8?B?ZnJhbmt5?= | last post by:
Hello, I've created a table that has two rows that are span across three columns. The third row has three columns, each with an image. The last row is also span accross three columns. The span...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.