Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > image in a div question

Reply
Thread Tools

image in a div question

 
 
the idiot
Guest
Posts: n/a
 
      07-11-2005
daft question alert...

i have a div with an image and words inside. but the div only extends
downwards to the end of the words and not the image.. how can i make it
extend to the height of the image?.... im sure the answer is simple but
sadly so am i.

it is here.
http://www.207g.karoo.net/new/index.html

thankyou very much


 
Reply With Quote
 
 
 
 
Peter
Guest
Posts: n/a
 
      07-11-2005
the idiot wrote:

>daft question alert...
>
>i have a div with an image and words inside. but the div only extends
>downwards to the end of the words and not the image.. how can i make it
>extend to the height of the image?.... im sure the answer is simple but
>sadly so am i.
>
>it is here.
>http://www.207g.karoo.net/new/index.html
>
>thankyou very much
>
>
>
>

I see no image. html reads= img scr=""
Peter

 
Reply With Quote
 
 
 
 
Els
Guest
Posts: n/a
 
      07-11-2005
the idiot wrote:

> daft question alert...
>
> i have a div with an image and words inside. but the div only extends
> downwards to the end of the words and not the image.. how can i make it
> extend to the height of the image?.... im sure the answer is simple but
> sadly so am i.
>
> it is here.
> http://www.207g.karoo.net/new/index.html


You floated the image, which means its parent doesn't extend to
include it. You can solve this by adding an element right before the
closing </div>, with the property clear:both;

<div>
<img src=".." alt="..." style="float:left;">
<p>text</p>
<br style="clear:both;">
</div>

(obviously the styles are better in a stylesheet, and the clearing
element doesn't need to be a <br>, could be anything suitable.)

> thankyou very much


You're welcome

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
 
Reply With Quote
 
the idiot
Guest
Posts: n/a
 
      07-11-2005

"Els" <> wrote in message
news...
> the idiot wrote:
>
> > daft question alert...
> >
> > i have a div with an image and words inside. but the div only extends
> > downwards to the end of the words and not the image.. how can i make it
> > extend to the height of the image?.... im sure the answer is simple but
> > sadly so am i.
> >
> > it is here.
> > http://www.207g.karoo.net/new/index.html

>
> You floated the image, which means its parent doesn't extend to
> include it. You can solve this by adding an element right before the
> closing </div>, with the property clear:both;
>
> <div>
> <img src=".." alt="..." style="float:left;">
> <p>text</p>
> <br style="clear:both;">
> </div>
>
> (obviously the styles are better in a stylesheet, and the clearing
> element doesn't need to be a <br>, could be anything suitable.)
>
> > thankyou very much

>
> You're welcome
>

ii shall try that and report back thank you.


 
Reply With Quote
 
the idiot
Guest
Posts: n/a
 
      07-11-2005

"Peter" <> wrote in message
news:42d238d8$0$47253$...
> the idiot wrote:
>
> >daft question alert...
> >
> >i have a div with an image and words inside. but the div only extends
> >downwards to the end of the words and not the image.. how can i make it
> >extend to the height of the image?.... im sure the answer is simple but
> >sadly so am i.
> >
> >it is here.
> >http://www.207g.karoo.net/new/index.html
> >
> >thankyou very much
> >
> >
> >
> >

> I see no image. html reads= img scr=""
> Peter


yeah sorry there is no actual image im just trying some things out.


 
Reply With Quote
 
the idiot
Guest
Posts: n/a
 
      07-11-2005

"Els" <> wrote in message
news...
> the idiot wrote:
>
> > daft question alert...
> >
> > i have a div with an image and words inside. but the div only extends
> > downwards to the end of the words and not the image.. how can i make it
> > extend to the height of the image?.... im sure the answer is simple but
> > sadly so am i.
> >
> > it is here.
> > http://www.207g.karoo.net/new/index.html

>
> You floated the image, which means its parent doesn't extend to
> include it. You can solve this by adding an element right before the
> closing </div>, with the property clear:both;
>
> <div>
> <img src=".." alt="..." style="float:left;">
> <p>text</p>
> <br style="clear:both;">
> </div>
>
> (obviously the styles are better in a stylesheet, and the clearing
> element doesn't need to be a <br>, could be anything suitable.)
>
> > thankyou very much

>
> You're welcome
>
> --

aha ho hum boohoo
it works in firefox but in IE the clearboth makes the <p> (below the div)
drop down in order to clear the left floated div (with the dotted right hand
border)....


 
Reply With Quote
 
rf
Guest
Posts: n/a
 
      07-11-2005
the idiot wrote:

> ii shall try that and report back thank you.


You might also try abandoning that fixed width stuff.

At my chosen minimum font size your nice "tabbed" navigation bar wraps to
the next line and looks quite odd. That is in addition to the wasted space
in my chosen viewport size.

Cheers
Richard.


 
Reply With Quote
 
Els
Guest
Posts: n/a
 
      07-11-2005
the idiot wrote:

> "Els" <> wrote in message
> news...
>> the idiot wrote:
>>
>>> daft question alert...
>>>
>>> i have a div with an image and words inside. but the div only extends
>>> downwards to the end of the words and not the image.. how can i make it
>>> extend to the height of the image?.... im sure the answer is simple but
>>> sadly so am i.
>>>
>>> it is here.
>>> http://www.207g.karoo.net/new/index.html

>>
>> You floated the image, which means its parent doesn't extend to
>> include it. You can solve this by adding an element right before the
>> closing </div>, with the property clear:both;
>>
>> <div>
>> <img src=".." alt="..." style="float:left;">
>> <p>text</p>
>> <br style="clear:both;">
>> </div>
>>
>> (obviously the styles are better in a stylesheet, and the clearing
>> element doesn't need to be a <br>, could be anything suitable.)
>>
>>> thankyou very much

>>
>> You're welcome
>>

> ii shall try that and report back thank you.


If it's a static page, and the size of the image never changes, you
could also just add
min-height:[height of image]; /* for non-IE */
_height:[height of image]; /* for IE only */

If the div has a height, IE will extend that height to encompass even
floated images.
The underscore will let other browsers ignore the property altogether,
while IE just ignores the underscore and reads the rest of the line.

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
 
Reply With Quote
 
the idiot
Guest
Posts: n/a
 
      07-11-2005

"rf" <@invalid.com> wrote in message
news:jXqAe.37483$...
> the idiot wrote:
>
> > ii shall try that and report back thank you.

>
> You might also try abandoning that fixed width stuff.
>
> At my chosen minimum font size your nice "tabbed" navigation bar wraps to
> the next line and looks quite odd. That is in addition to the wasted space
> in my chosen viewport size.
>
> Cheers
> Richard.
>

hehe thanks...


 
Reply With Quote
 
the idiot
Guest
Posts: n/a
 
      07-11-2005

"Els" <> wrote in message
news:gbo0ohbomexc$....
> the idiot wrote:
>
> > "Els" <> wrote in message
> > news...
> >> the idiot wrote:
> >>
> >>> daft question alert...
> >>>
> >>> i have a div with an image and words inside. but the div only extends
> >>> downwards to the end of the words and not the image.. how can i make

it
> >>> extend to the height of the image?.... im sure the answer is simple

but
> >>> sadly so am i.
> >>>
> >>> it is here.
> >>> http://www.207g.karoo.net/new/index.html
> >>
> >> You floated the image, which means its parent doesn't extend to
> >> include it. You can solve this by adding an element right before the
> >> closing </div>, with the property clear:both;
> >>
> >> <div>
> >> <img src=".." alt="..." style="float:left;">
> >> <p>text</p>
> >> <br style="clear:both;">
> >> </div>
> >>
> >> (obviously the styles are better in a stylesheet, and the clearing
> >> element doesn't need to be a <br>, could be anything suitable.)
> >>
> >>> thankyou very much
> >>
> >> You're welcome
> >>

> > ii shall try that and report back thank you.

>
> If it's a static page, and the size of the image never changes, you
> could also just add
> min-height:[height of image]; /* for non-IE */
> _height:[height of image]; /* for IE only */
>
> If the div has a height, IE will extend that height to encompass even
> floated images.
> The underscore will let other browsers ignore the property altogether,
> while IE just ignores the underscore and reads the rest of the line.
>
> --

i shall try... or return to bed whichever is the easiest.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not 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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
<div ... /> and <div ...></div> K Viltersten ASP .Net 4 03-31-2009 07:33 PM
When I hide a div, the image in the div still visible in internetexplorer Faraz.ya@gmail.com Javascript 4 12-25-2007 11:03 PM
CSS question: div cover another div on AJAX dunnil HTML 1 02-05-2006 08:59 AM
NS/FF don't change div offsetWidth when div innerHTML is added toand div becomes wider mscir Javascript 3 06-26-2005 04:04 PM
Q: Div A inside Div B is larger than Div B Dwayne Madsen Javascript 1 06-01-2005 03:02 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57