Welcome visitor
* Login
* Register
It is currently March 25th, 2019, 3:12 am
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » HTML



Post new topic Reply to topic  [ 5 posts ] 
Author Message
  Place an image next to a div
PostPosted: August 30th, 2009, 12:50 am 

Posts: 17
Why is it that i cant put an image next to a div and how could i do it?
A simple question but i cant get a way around this,only using tables, which i dont wanna do anymore.
Thanks everybody for your help.


Top
 Profile  
 
  Re: Put an image next to a div
PostPosted: August 30th, 2009, 1:07 am 
User avatar

Posts: 70
divs are displayed in block, that's their natural property, spans are, as well as images, displayed inline. with css you can reverse either of these properties.
div{display: inline} //this answers your question
span{display: block} //this changes the css default for spans
img{display: block} //this changes the css default for imgs and messes up your page again


Top
 Profile  
 
  Re: Place an image next to a div
PostPosted: October 6th, 2009, 10:59 pm 
Site Admin
User avatar

Posts: 39
You can also set the CSS float property for the div and images to left, right, etc

_________________
I'm not afraid to die. I just don't want to be there when it happens.
- Woody Allen


Top
 Profile  
 
  Re: Place an image next to a div
PostPosted: October 7th, 2009, 7:20 am 
User avatar

Posts: 137
yeah, it depends on what you want to do.

<div style="float: left"><img src="file.jpg" /></div>lalalalala

this will put the text on the upper available part and the next puts the text in the "last line" of the div.
<div style="style: inline"><img src="file.jpg" /></div>lalalalala

float looks better right? but be careful or it will mess pretty much all your current alignments.


Top
 Profile  
 
  Re: Place an image next to a div
PostPosted: October 10th, 2009, 10:10 pm 
User avatar

Posts: 21
TIP:

Once you are done with all the "floating", you can add a breaker DIV. This way, everything you place after the breaker DIV will appear in its normal order, this is, from top to bottom.

Here's the code for the magic breaker DIV:

<div style="clear: both;"></div>


After this... No more floating mess!!!

REGARDS!!

_________________
IT. Consulting
www.tnogos.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

FORUMS » Client Side » HTML


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron