473,424 Members | 1,695 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,424 software developers and data experts.

help with image alignment inside a <div>

Hi all,

I am having a problem that seems so simple, I am almost embarrassed to
ask about it.

I am working on a page that has the layout largely css driven. The top
of the page has two <img> tags, one a logo, the other a graphic just for
looks. If I use the following code:

<div id="header">
<nobr><img src="jclogo.gif" alt="Jaycees logo" width="200"
height="115"><img src="testbanner2.jpg" alt="banner, Peoria Skyline"
width="580" height="115"></nobr>
</div>

Everything works, but is left justified and butted up against each other.

What I would like, is the logo to be left justified, and the other
graphic to be right justified.

If I add align="right" (or a class to the css aligning it right), it
works fine in IE6, but in FF/Moz it ends up under the 'header' <div>, on
top of the main content of the page..almost like it was floated from
another <div>.

The mock-up can be viewed at
http://s120378707.onlinehome.us/mock1/mock1-broken.htm

The one where it is left justified is at
http://s120378707.onlinehome.us/mock1/mock1.htm

If you need the css file to assist, let me know (like I said, even
align="right" on the <img> tag has this effect.

Thanks,

Tim
Jul 23 '05 #1
4 7215
Tim Sheets wrote:
Hi all,

I am having a problem that seems so simple, I am almost embarrassed to
ask about it.

I am working on a page that has the layout largely css driven. The top
of the page has two <img> tags, one a logo, the other a graphic just for
looks. If I use the following code:

<div id="header">
<nobr><img src="jclogo.gif" alt="Jaycees logo" width="200"
height="115"><img src="testbanner2.jpg" alt="banner, Peoria Skyline"
width="580" height="115"></nobr>
</div>

Everything works, but is left justified and butted up against each other.

What I would like, is the logo to be left justified, and the other
graphic to be right justified.

If I add align="right" (or a class to the css aligning it right), it
works fine in IE6, but in FF/Moz it ends up under the 'header' <div>, on
top of the main content of the page..almost like it was floated from
another <div>.

The mock-up can be viewed at
http://s120378707.onlinehome.us/mock1/mock1-broken.htm

The one where it is left justified is at
http://s120378707.onlinehome.us/mock1/mock1.htm

If you need the css file to assist, let me know (like I said, even
align="right" on the <img> tag has this effect.

Thanks,

Tim

Mock 1 broken looks fine to me (FF). Did you solve the problem? I see
the strange <nobr> tag is gone :)

Anyway I was going to advice you to take a look at the CSS float property.
Jul 23 '05 #2
Ståle Sæbøe wrote:
Tim Sheets wrote:
Hi all,

I am having a problem that seems so simple, I am almost embarrassed to
ask about it.

I am working on a page that has the layout largely css driven. The
top of the page has two <img> tags, one a logo, the other a graphic
just for looks. If I use the following code:

<div id="header">
<nobr><img src="jclogo.gif" alt="Jaycees logo" width="200"
height="115"><img src="testbanner2.jpg" alt="banner, Peoria Skyline"
width="580" height="115"></nobr>
</div>

Everything works, but is left justified and butted up against each other.

What I would like, is the logo to be left justified, and the other
graphic to be right justified.

If I add align="right" (or a class to the css aligning it right), it
works fine in IE6, but in FF/Moz it ends up under the 'header' <div>,
on top of the main content of the page..almost like it was floated
from another <div>.

The mock-up can be viewed at
http://s120378707.onlinehome.us/mock1/mock1-broken.htm

The one where it is left justified is at
http://s120378707.onlinehome.us/mock1/mock1.htm

If you need the css file to assist, let me know (like I said, even
align="right" on the <img> tag has this effect.

Thanks,

Tim


Mock 1 broken looks fine to me (FF). Did you solve the problem? I see
the strange <nobr> tag is gone :)

Anyway I was going to advice you to take a look at the CSS float property.


I ran a validation against it, and cleaned that stuff up (any substitute
for the <nobr>??? I would really like to keep the images from wrapping
in the banner.

No, not really fixed. What I did find, is that I was using position:
absolute; in the css, and you have to specify a top: property, which I
had not...only a right: setting. That is where the flakey behavior
probably came from. I still haven't gotten things to work like I want
them. I'll try playing with the float properties.

Thanks,

Tim
Jul 23 '05 #3
Tim Sheets wrote:


Mock 1 broken looks fine to me (FF). Did you solve the problem? I see
the strange <nobr> tag is gone :)

Anyway I was going to advice you to take a look at the CSS float
property.

I ran a validation against it, and cleaned that stuff up (any substitute
for the <nobr>??? I would really like to keep the images from wrapping
in the banner.

No, not really fixed. What I did find, is that I was using position:
absolute; in the css, and you have to specify a top: property, which I
had not...only a right: setting. That is where the flakey behavior
probably came from. I still haven't gotten things to work like I want
them. I'll try playing with the float properties.


Using a couple of floats and a clear did the trick.

I had to float: left; the logo, and float: right; the banner.jpg Then,
then next <div> had to clear: both;

Any ideas on how to keep the banner images from wrapping to a new line
if the viewport is resized too small?

Thanks again for the pointer.

Tim
Jul 23 '05 #4
Els
Tim Sheets wrote:
Tim Sheets wrote:


Mock 1 broken looks fine to me (FF). Did you solve the problem? I see
the strange <nobr> tag is gone :)

Anyway I was going to advice you to take a look at the CSS float
property.

I ran a validation against it, and cleaned that stuff up (any substitute
for the <nobr>??? I would really like to keep the images from wrapping
in the banner.

No, not really fixed. What I did find, is that I was using position:
absolute; in the css, and you have to specify a top: property, which I
had not...only a right: setting. That is where the flakey behavior
probably came from. I still haven't gotten things to work like I want
them. I'll try playing with the float properties.


Using a couple of floats and a clear did the trick.

I had to float: left; the logo, and float: right; the banner.jpg Then,
then next <div> had to clear: both;

Any ideas on how to keep the banner images from wrapping to a new line
if the viewport is resized too small?


Floats do that by default.
You could float the left image left, and set the other image to right
align (not float) inside a div which has margin-left:[width of left
image].
Alternatively, you could have the left image just left aligned, and
the other one as a background to <div id="header">.
(background-position:right top;).
This way when the window gets too small, that image will just go
behind the left image.

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Squeeze - Labelled With Love
Jul 23 '05 #5

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

Similar topics

1
by: Xah Lee | last post by:
with strict HTML spec, can one have <p> tags inside table's <td> tag? also, in strict XHTML, can one have <p> tages inside <div>? Thanks. Xah xah@xahlee.org ∑ http://xahlee.org/
3
by: Joseph Haig | last post by:
I have a style sheet containing the following definitions: #leftcontent { position: absolute; left:20px; top:60px; width:180px; border:1px solid #000; padding-top: 15px; }
8
by: slim | last post by:
hi again all, i am still working on the website as mentioned in earlier threads and have hit another snag... http://awash.demon.co.uk/index.php http://awash.demon.co.uk/vd.css the php is...
0
by: tomasio | last post by:
Dear NG-Readers, First I want to apologize for crossposting this, but I got no idea where this topic really belongs to. I have built a html-page with some CSS. Anything behaves as expected, just...
7
by: simchajoy2000 | last post by:
Hi, I am just a javascript beginner so maybe this is a simple problem but I am trying to do some rollovers on images in a separate <div>. Here is the relevent piece of my code: <html>...
5
by: chakradhari.ashish | last post by:
Does anybody know how can I load an html page inside a <div</div> where the content gets update on the onclick even of anchor <a href=> </a>? I googled around and followed some links pointing me...
8
by: CJM | last post by:
I've inserted a new banner in an existing page and I want the banner image to be centered (horizontally) within its container. I'm not bothered whether the accompanying line of text is restricted...
8
prino
by: prino | last post by:
Hi all, I've written code (in REXX) that takes files in legacy languages (PL/I, COBOL, z/OS assembler, etc) and converts them into HTML in a format similar to what's displayed in the z/OS ISPF...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.