gap between img and div

This is a discussion on "gap between img and div" within the Web Page Design section. This forum, and the thread "gap between img and div are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 15th, 2006, 03:01
Junior Member
Join Date: Nov 2006
Location: marion
Age: 23
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
gap between img and div

hello!

I am working on a layout at this page with this code:
Code: Select all
<img src="images/header.png" usemap="#squishyfishy" border="0" width="886" height="149" margin="0" padding="0"/>
                <map name="squishyfishy">
                  <area shape="rect" coords="79,66,266,136" href="http://pulse.comteck.com/" />
                  <area shape="rect" coords="710,78,775,134" href="http://comteck.com/info/v92FAQ.html" />
                </map>
                <div id="nav">
                <ul>
                    <li id="current"><a href="/">Home</a></li>
                    <li><a href="default.htm" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu1, '90px')" onMouseout="delayhidemenu()">Services    +</a></li>
                    <li><a href="#">Mail Guardian</a></li>
                    <li><a href="#">Free Classifieds</a></li>
                    <li><a href="http://iguessnot.com">News </a></li>
                      <li><a href="#">Search Page</a></li>
                    <li><a href="#">Rates</a></li>
                    <li><a href="#">Set Up Help</a></li>
                    <li><a href="#">FAQs</a></li>
                    <li><a href="default.htm" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu2, '100px')" onMouseout="delayhidemenu()">About    +</a></li>
                    
                   </ul>
            </div>
The problem here is that there is a little white space about 3px wide between my div tag and img tag.

In my css, I defined the #nav as:
Code: Select all
#nav {
    background: #000 url(/images/menu.jpg) no-repeat center bottom;
    background-color: #000;
    width: 886px;
    height: 29px;
    margin: 0px;
    padding: 0px;
}
I'm very confused and frustrated and I really appreciate any and all help on how to fix this.

Thanks a ton!
Reply With Quote

  #2 (permalink)  
Old Nov 15th, 2006, 09:41
New Member
Join Date: Nov 2006
Location: Israel
Age: 26
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: gap between img and div

try putting the img tag inside the div
Reply With Quote
  #3 (permalink)  
Old Nov 15th, 2006, 12:52
Junior Member
Join Date: Nov 2006
Location: marion
Age: 23
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Re: gap between img and div

I've can't put it inside the same div because the div is <div class="nav"> which has my navigation bar for a background image. It would just tile the navbar image.

I did try putting the img and div within the same div
Code: Select all
<div>
<img src="images/header.png" usemap="#squishyfishy" border="0" width="886" height="149" margin="0" padding="0"/>
            <div id="nav">
                <ul>
                    <li id="current"><a href="/">Home</a></li>
                    <li><a href="default.htm" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu1, '90px')" onMouseout="delayhidemenu()">Services    +</a></li>
                    <li><a href="#">Mail Guardian</a></li>
                    <li><a href="#">Free Classifieds</a></li>
                    <li><a href="http://iguessnot.com">News </a></li>
                      <li><a href="#">Search Page</a></li>
                    <li><a href="#">Rates</a></li>
                    <li><a href="#">Set Up Help</a></li>
                    <li><a href="#">FAQs</a></li>
                    <li><a href="default.htm" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu2, '100px')" onMouseout="delayhidemenu()">About    +</a></li>
                    
                   </ul>
            </div>
</div>
but when I do that, the entire header image disapears... which makes no sense anyway.

grrrr
Reply With Quote
  #4 (permalink)  
Old Nov 15th, 2006, 16:21
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: gap between img and div

Somewhere early in your css you should have;
Code: Select all
img {
    padding: 0;
    margin: 0;
}
to make sure the browsers are not adding any default spacing around images.

If that doesn't fix it, put the page somewhere live where we can see it.

Ok, forget that. I've just noticed you have included it inline. Looks like we need to see the page.

Last edited by ukgeoff; Nov 15th, 2006 at 16:22. Reason: Additional comment
Reply With Quote
  #5 (permalink)  
Old Nov 15th, 2006, 16:47
Junior Member
Join Date: Nov 2006
Location: marion
Age: 23
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Re: gap between img and div

the test site is comteck.iguessnot.com.

You can see that there is maybe... 5 or 6 pixels of space.

Also, I have added in my header img tag margin="0" padding="0" but you are suggesting that I should make a new css tag with that img info?

I will certainly try that.

The links included in the original code link back to the site that I am beefing up... which is dreadful lol.

I really appreciate this as I am losing my cotton pickin mind!
Reply With Quote
  #6 (permalink)  
Old Nov 15th, 2006, 16:50
Junior Member
Join Date: Nov 2006
Location: marion
Age: 23
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Re: gap between img and div

ok i added the
Code: Select all
img {     padding: 0;     margin: 0; }
and unfortunatley it didn't work.
Reply With Quote
  #7 (permalink)  
Old Nov 16th, 2006, 06:26
Reputable Member
Join Date: Dec 2005
Location: Texas
Age: 19
Posts: 328
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to daygon Send a message via MSN to daygon Send a message via Yahoo to daygon
Re: gap between img and div

try:
Code: Select all
img{width:100%}
that might work if i looked at your code right.
Reply With Quote
  #8 (permalink)  
Old Nov 16th, 2006, 08:58
Junior Member
Join Date: Nov 2006
Location: London
Age: 22
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Re: gap between img and div

I just registered to help you... i have this problem all the time. Annoys me everytime and each time i forget the solution. This time i remembered. (yay me)

Just put display:block on all your image styles. If that fails on your divs as well.
Reply With Quote
  #9 (permalink)  
Old Nov 16th, 2006, 12:30
Junior Member
Join Date: Nov 2006
Location: marion
Age: 23
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Re: gap between img and div

Quote:
I just registered to help you... i have this problem all the time. Annoys me everytime and each time i forget the solution. This time i remembered. (yay me)

Just put display:block on all your image styles. If that fails on your divs as well.
!!!!Perad!!!!: mrgreen:

Thank you thank you thank you!

I appreciate it so much! I don't even know what that display:block means yet, but it worked perfectly.

I thank you so much!!
Reply With Quote
  #10 (permalink)  
Old Nov 16th, 2006, 12:52
Junior Member
Join Date: Nov 2006
Location: London
Age: 22
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Re: gap between img and div

Quote:
Originally Posted by selina View Post
!!!!Perad!!!!: mrgreen:

Thank you thank you thank you!

I appreciate it so much! I don't even know what that display:block means yet, but it worked perfectly.

I thank you so much!!
I'm glad i could help... as for display block i don't know what it means either. If anyone can explain it the please feel free.
Reply With Quote
  #11 (permalink)  
Old Nov 16th, 2006, 16:20
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: gap between img and div

The css atribute-value pair display: block, is the default for some elements such as <div> and <p> and it means two things. One that the element is actually visible and the second that it will take up as much width as possible.

Elements of this type naturally stack up on top of each other as apposed to side by side.

Two of the other values most commonly used are; none and inline.

As block is the default style for certain elements, explicitely specifying it should not have been the solution. I will look at your page and post further.
Reply With Quote
  #12 (permalink)  
Old Nov 16th, 2006, 17:29
Reputable Member
Join Date: Dec 2005
Location: Texas
Age: 19
Posts: 328
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to daygon Send a message via MSN to daygon Send a message via Yahoo to daygon
Re: gap between img and div

Once again geoff is here to explain everything to us. Thank You
Reply With Quote
  #13 (permalink)  
Old Nov 16th, 2006, 17:49
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,763
Blog Entries: 1
Thanks: 0
Thanked 18 Times in 18 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: gap between img and div

Block Level Elements as stated are like this:

[ element ]
[ element ]

Inline elements i.e. span, etc... are like this:

[ element ] [ element ]

The Attributes are:

display:inline;
display:block;

For example if you wanted an unordered list to be horizontal you would use display:inline; or if you displayed each li as a block you would float: the li etc.. Hope that clears it up a bit.
__________________
The internet is just a fad.
http://www.mevans76.com
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Reply With Quote
  #14 (permalink)  
Old Nov 16th, 2006, 18:33
Junior Member
Join Date: Nov 2006
Location: marion
Age: 23
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Re: gap between img and div

now that I understand what that element means, i wonder why it solved my problem?

I must have coded something wrong to begin with.

If anyone wants, please feel free to check out my css to see if I dropped the ball on something.

css

I am so happy I found this forum.
Reply With Quote
  #15 (permalink)  
Old Nov 17th, 2006, 00:19
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,763
Blog Entries: 1
Thanks: 0
Thanked 18 Times in 18 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: gap between img and div

One thing I did notice was this:

Code: Select all
/* For IE... */
* html .sd_right {
    clear:both;
    background-color: #FFF;
    float: right;
    color: #000;
    margin: 0 40px 0 0;
    padding: 0px 0px 0 15px;
    width: 170px;
    border-left: 1px dashed #ccc;
Save yourself some trouble and headache later and make a IE specific style sheet and place it with a conditional comment in the head of your documents..

<!--[if lte IE 6]>
Special instructions for IE 6 here
<![endif]-->

LTE = lesser than or equal too
LT = Lesser than
etc...

And then of course for IE 7 etc..

<!--[if IE 7]>
Special instructions for IE 7 here
<![endif]-->
__________________
The internet is just a fad.
http://www.mevans76.com
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Reply With Quote
  #16 (permalink)  
Old Nov 17th, 2006, 05:48
Reputable Member
Join Date: Dec 2005
Location: Texas
Age: 19
Posts: 328
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to daygon Send a message via MSN to daygon Send a message via Yahoo to daygon
Re: gap between img and div

I dont know why but IE is getting more and more problems with viewing web page properties. I think IE should be completely takes off and Firefox should come installed on every windows computer. But thats just my opinion. Too many spacifics with IE and its the only browser anyone has troubles with. Garbage.
Reply With Quote
  #17 (permalink)  
Old Nov 17th, 2006, 13:57
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,763
Blog Entries: 1
Thanks: 0
Thanked 18 Times in 18 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: gap between img and div

It unfortunately is a core component of the operating system. i.e. windows explorer or something.
__________________
The internet is just a fad.
http://www.mevans76.com
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Reply With Quote
  #18 (permalink)  
Old Nov 17th, 2006, 16:03
Junior Member
Join Date: Nov 2006
Location: marion
Age: 23
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Re: gap between img and div

yeah i use firefox and apparently microsoft's newest explorer is a cheap imitation of firefox.

i don't even want to include IE fixes, but tons-o-ppl use it, so I have to. grrr
Reply With Quote
Reply

Tags
img white space

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 On


All times are GMT. The time now is 17:45.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

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