Jump to content

Recommended Posts

I'm trying to figure out how to set up the following:

 

 

Product Title                                                            Image

-------------------------------------------------------------

 

I'm trying to float the image to the right, but I cannot get both to sit on the underline (which is applied to the h# on the left).

 

How do you use CSS to set up this situation?? I cannot use a left margin on the image because there are a bunch of products and each has a title that has a unique length.

 

Thanks,

RyanOD

Link to comment
https://forums.phpfreaks.com/topic/58162-h-next-to-a-float-help/
Share on other sites

Yes, but the problem with that is I want the bottom of the header and the bottom of the image to align because I have a border-bottom on the header that extends across the page. Since the header and the image have different heights, the bottom border will run across the page and through the image.

 

Once I have the two pieces side by side (header on the left, image on the right), how can I insure they have bottom alignment? I have tried vertical-align, but that doesn't work.

 

Thanks for the input.

 

RyanOD

try this out:

h3
{

clear: right;
height: 20px;
border-bottom: 1px dotted black;
margin-top: -20px;



}
img
{
float: right;
}

 

<img src="your_pic.gif"/>
<h3>This is my Picture</h3>

 

Might have to play around with the heights of the h tag to get it to look right in all browsers but this looks right in IE 6 and Firefox for me.

 

EDIT...nah the negative top margin isn't working in firefox...i'll keep thinking about it.

try this out:

h3
{

clear: right;
margin: 0; padding: 0;
border-bottom: 1px dotted black;
position: relative;
left: 0; top: -20px;

}
img
{
float: right;
}

 

<img src="your_pic.gif"/>
<h3>This is my Picture</h3>

 

 

 

I think the above should work out.  You will have to play around with the top: 20px to whatever makes it slide into place cross browser.  Also since it is position relative, it still takes up the space it was moved from so there will be a 20px gap between each row, but you would probably want some space between rows anyway.

You can align text with the bottom of an image using CSS.

 

Check out this page: http://www.bigbaer.com/css_tutorials/css.vertical.align.image.styles.htm

 

They don't supply any code, so you'll have to look at the source code and CSS yourself. But look at the examples and it's all there.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.