icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » Coding and Programming » Smaller image next to larger one, possible with div?

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
Old July 17th, 2005, 7:25 AM   #1 (permalink)
Registered User
Fresh Surpasser
 
Joined in Oct 2003
13 posts
Gave thanks: 0
Thanked 0 times
Unhappy Smaller image next to larger one, possible with div?

Hi there. I'm trying to do the simplest thing but somehow I can't figure it out ;_;

I'm trying to put two images side-by-side as if they were two columns in a table. Like so:

Image #1 is 100 pixels wide, 10 pixels high.
Image #2 is 130 x 130 with three lines of text below it. It currently wraps.

A table exists below the images.

Take a look at capture.hindsightproject.com (it's the graphic "Music" followed by the disc image and some text). I ripped the poor css and code out at the moment so I don't get confused in the morning.

I'm trying to figure out why I'm having such a hard time with something so basic. Then again, I come from the old school of creating everything with tables

I tried making a wrapper of some sort but that didn't help either. In fact it made the table below the two images (Powered by...) overlap the images in Firefox!

I'm going to sleep since its 4am, I think my brain is fried about something so simple
wongJP is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old August 13th, 2005, 3:54 PM   #2 (permalink)
Dez
Registered User
Fresh Surpasser
 
Joined in Aug 2005
Lives in Sussex, England
5 posts
Gave thanks: 0
Thanked 0 times
The easiest way to do this is to use the float property. This will literally make it "float" over the rest of the page. To stop overlapping, you need to give a margin to the non-floating area of the page equal to or more than the width of the floating object.

That all could just sound like technobabble to you, so here's an example:

<!-- This DIV will appear on the left -->
<div style="float:left; width:100px">
...
</div>

<!-- This DIV will appear on the right -->
<div style="margin-left:110px">
...
</div>

The first DIV is 100 pixels wide, and will be on the far left of the page. The second DIV will be 110px to the right of the first DIV, giving a 10-pixel margin between them. You can replace the DIVs with any tag you like, but if it is in-line by default (ie. images), you'll need to add display:block to its properties as well as the float/margin.

Hope this helps.
Dez is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On