PDA

View Full Version : IMG inside Div!


africano
12-18-2008, 02:46 PM
Ive got a div and text inside it. The text is where its supposed to be, but now I want to add an image inside the div and I want it to align to the right, whereas the text is on the left. If I try and change the position of the img via align my text messes up.....How can I position the img where I want it(to the right) without messing up the text?

Cheers!

rico1931
12-18-2008, 03:19 PM
Hi africano,

You will want to insert the picture into another Div Tag and do something like a float right.

africano
12-18-2008, 03:21 PM
yeah thats what I thought...was just wondering if there was any other way....didnt want to add another div tag just for the img but it looks like Im gonna have to!

rico1931
12-18-2008, 03:23 PM
ah yes but the beauty of CSS haha just add div tag within div tag until you get so confused and can't think of more names to add haha... thats what is happening to me now with my site and trying to dynamically populate imgs within certain div tags. just not working to well for me right now

d a v e
12-18-2008, 05:03 PM
just float the image without adding another div. if it doesn't work for you then post a link to the page

rico1931
12-18-2008, 05:10 PM
Does "float" work with just the img src tag?

domedia
12-18-2008, 05:42 PM
Yes, try it out:
<img src="photo.jpg" style="float: right;">

rico1931
12-18-2008, 05:45 PM
Nice I didn't know that.. Yup I just tried it out and it worked! I have another question and maybe i'll just post another thread but say you have a picture but there is some txt in front of the picture like the file name. Is there any way to cut out the file name and just post the picture? I guess the question is that the file name and path name are the same and I want to take out the path name from being displayed when the pic is rendered from a path name in the DB

domedia
12-18-2008, 06:07 PM
Can you post your code? This makes little sense to me right now :)

rico1931
12-23-2008, 02:35 PM
Hi Domedia,

Sorry I did not see your post before but here is the code


<td>
<span class="<%=(rsFacts.Fields.Item("FACT_ElmID").Value)%>">
<%=(rsFacts.Fields.Item("FACT_Content").Value)%></span>

<img src="..\..\site\<%=(rsFacts.Fields.Item("FACT_Content").Value)%>"
class="<%=(rsFacts.Fields.Item("FACT_ElmID").Value)%>" />
</td>
</tr>
See where img src starts, well it points the file name in the DB which finds it in the folder on the server. What I want is to take out the file name which shows up on the server. The way the picture is displayed is with a While Repeat function and it displays both the file name and picture along with the rest of the content in the DB that I want