473,320 Members | 2,020 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,320 software developers and data experts.

Centering absolute placed images with CSS?

<body>

<div style="position:absolute; left:0px; top:0px; width:780px;
height:42px; ">
<img src="images/CW---Webpage_01.png" width=780 height=42>
</div>
<div style="position:absolute; left:0px; top:42px; width:52px;
height:488px; ">
<img src="images/CW---Webpage_02.png" width=52 height=488>
</div>

</body>
How do I make this appear in the center of the page so it will work on
different screen widths. I know you can do it with tables, but I'd
like to use CSS.

Thanks
Jul 20 '05 #1
2 2346
Headless <in*************@dna.ie> wrote in message news:<ia********************************@4ax.com>. ..
ze******@softhome.net (Zeke Koos) wrote:
<body>

<div style="position:absolute; left:0px; top:0px; width:780px;
height:42px; ">
<img src="images/CW---Webpage_01.png" width=780 height=42>
</div>
<div style="position:absolute; left:0px; top:42px; width:52px;
height:488px; ">
<img src="images/CW---Webpage_02.png" width=52 height=488>
</div>

</body>
How do I make this appear in the center of the page so it will work on
different screen widths. I know you can do it with tables, but I'd
like to use CSS.


<head>
<style type="text/css">
img.class{display:block;margin:0 auto}
</style>
</head>
<body>
<img src="img1.png" width="780" height="42" class="class" alt="">
<img src="img2.png" width="52" height="488" class="class" alt="">
</body>

Use suitable alt content, name the class appropriately, make sure IE is
not in quirk mode.

That does not work with absolutely placed images, thanks for replying though :)
Jul 20 '05 #2
Els

"Zeke Koos" <ze******@softhome.net> schreef in bericht
news:e5**************************@posting.google.c om...
Headless <in*************@dna.ie> wrote in message

news:<ia********************************@4ax.com>. ..
ze******@softhome.net (Zeke Koos) wrote:
<body>

<div style="position:absolute; left:0px; top:0px; width:780px;
height:42px; ">
<img src="images/CW---Webpage_01.png" width=780 height=42>
</div>
<div style="position:absolute; left:0px; top:42px; width:52px;
height:488px; ">
<img src="images/CW---Webpage_02.png" width=52 height=488>
</div>

</body>
How do I make this appear in the center of the page so it will work ondifferent screen widths. I know you can do it with tables, but I'dlike to use CSS.


<head>
<style type="text/css">
img.class{display:block;margin:0 auto}
</style>
</head>
<body>
<img src="img1.png" width="780" height="42" class="class" alt="">
<img src="img2.png" width="52" height="488" class="class" alt="">
</body>

Use suitable alt content, name the class appropriately, make sure IE is not in quirk mode.

That does not work with absolutely placed images, thanks for

replying though :)

I couldn't read your original post anymore, so I'm guessing at what
you want to achieve,
but if I understand it right, you could use the following code:
<body>
<div style="width:780px; margin-right:auto; margin-left:auto;
margin-top:0px; padding:0px; text-align:left;">
<div style="position: relative; top: 0px; left: 0px;">
<div style="position:absolute; left:0px; top:0px;
width:780px;height:42px;"><img src="images/CW---Webpage_01.png"
width=780 height=42></div>
<div style="position:absolute; left:0px; top:42px;
width:52px;height:488px;"><img src="images/CW---Webpage_02.png"
width=52 height=488></div>
</div>
</div>
</body>


Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: George Ziniewicz | last post by:
.. I try to use CSS when possible, though I am still learning and don't maximize its use. In particular, I still use a table to provide for a centered image in a few slideshows (though table...
9
by: Faz | last post by:
Hi I'm having some real trouble with a header I have created within a container. I have two problems; firstly the menu (a horizontal UL) will not centre within the surrounding header, despite...
5
by: david hepworth | last post by:
I am in the process of creating a CSS tab style thing for my webpage. I have everything as i wish except that i cannot center the damn thing in the page. I am hoping someone out there can help. I...
2
by: kevinC | last post by:
Hello, I know most of you are probably going seeing positioning:absolute; and centering in the title and saying, oh no! not again! Do a google search! Actually, I've found many helpful...
3
by: BT | last post by:
I have taken over the support of an existing webpage and I need to revise the page so that it is centered (left and right) on the screen instead of aligned on the left. I can do this easily, but...
2
by: tonsi | last post by:
I have a page but it wont center the div. Can anyone take a look at it and help. When I try to center in the body using text-align: center; it doesn't work with the main container (called Table_01)....
14
by: issentia | last post by:
I'm working on this site: http://www.essenceofsoy.com/redesign/index2.html and I'm having a few problems with getting the layout exactly right. 1) When the menu items are rolled over, they...
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...
5
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.