473,770 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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"><i mg src="testbanner 2.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 7236
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"><i mg src="testbanner 2.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"><i mg src="testbanner 2.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
3496
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
14407
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
5157
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 pulling a name and placing it under the thumbnail (the text is
0
359
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 the two images inside the <div> with the class attributes "schraffur-bottom" and "content-bottom" appear 10px below their corresponding containers. As the two pics are 10px high in total, I think it has something to do with the images. Anybody...
7
2462
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> <head> <script type="text/javascript"> if (document.images) {
5
39013
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 that it is possible to use javascript combined with CSS for doing this? Any ideas? Chakra
8
609
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 to the width of the image and centered, or whether is simply fills the width of the container. I've tried various things to achieve this (e.g setting margins to auto) but I'm not having much luck. The URL for the page is: http://www.eminox.es
8
10047
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 editor. A fellow member of the PCG has helped me by creating a bit of Javascript to emulate the scrolling and using Google I've now gotten it into a state where it almost passes the W3C Markup Validation Service. However, the one error, Error Line 166,...
0
9617
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10257
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10099
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8931
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7456
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.