/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Div doesn’t float right in FF

Hello all,

I’m currently working on my own version of a photo gallery for a school site. I’ve tried two different methods so far, one being an inline list (which looks pretty crappy), and one being left floated divs. This works great, and allows me the control I need, however some bad code somewhere is making the whole photo gallery interact with another div on the page, and, well, you’ll see.

Link: [url]http://www.coloradocollege.edu/giving/1874/events/blacktie.htm[/url]
CSS: [url]http://www.coloradocollege.edu/giving/1874/style.css[/url]

Relevant CSS Code:

[code]
.whole{
width:680px;/*+30*/
position:relative;
margin:0 auto 0 auto;
height:700px;
padding-bottom:100px;
}

html>body .whole{
padding-bottom:0;
}

/*left stuff*/

.nav, .newsHeader {
font-size:large;
}

.nav, .news {
top:2px;
left:2px;
width: 140px;
background-color:#bb8410;
margin:2px;
padding:5px;
color:#FFFFFF;
}

.newsBorder{
position:relative;
margin-top:10px;
margin-bottom:50px;
}

.navBorder, .newsBorder{
border:thin solid #bb8410;
float:left;
}

.newsBorder{
clear:left; [B]/*I think this is where the problem lies, but I don’t know a way around it.*/[/B]
}

/*this is how I do it with divs */

.thumbnail{
float:left;
width: 140px;
height:200px;
text-align:center;
margin:0 2px 20px 2px;
overflow:hidden;
color:white;
}

.thumbnail img{
/*border:solid thin white;*/
border-color:#bb8410;
border-style:ridge;
border-width:thick;
}

/*and this is how i do it with inline lists */

ul{

}

ul li{
display:inline;
margin-left: 10px;
}

ul li img{
border-color:#bb8410;
border-style:ridge;
border-width:thick;
}

[/code]

And the HTML:

[code=html]

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>1874 Society</title>

<link href=”../style.css” rel=”stylesheet” type=”text/css” />

</head>

<body>

<!– CC Header –>
<div align=”center”>
<script language=”JavaScript” type=”text/JavaScript” src=”http://www.coloradocollege.edu/include/navbar.asp?js=true&amp;roll=&amp;width=765&amp;style=”></script>
</div>
<!– /CC Header –>

<!– logo –>
<div align=”center”>
<p><img src=”../images/logo.gif” alt=”1874 Society Logo” width=”297″ height=”158″/></p>
</div>
<!– /logo –>

<!– Main Content –>
<div class=”whole”>

<!– Nav –>
<div class=”navBorder”>
<div class=”nav”>
<!– #BeginLibraryItem “/Library/nav.lbi” –><span class=”shadow_container”>Home<span class=”shadow_text”><a href=”index.htm”>Home</a></span></span>
<p> <span class=”shadow_container”>Join Today<span class=”shadow_text”><a href=”https://secure.infront.com/coloradocollege/donate.asp” target=”_blank”>Join Today</a></span></span> </p>
<p> <span class=”shadow_container”>Contact<span class=”shadow_text”><a href=”contact.htm”>Contact</a></span></span> </p>
<p> <span class=”shadow_container”>Events<span class=”shadow_text”><a href=”events.htm”>Events</a></span></span> </p>
<p> <span class=”shadow_container”>Newsletters<span class=”shadow_text”><a href=”newsletters.htm”>Newsletters</a></span></span></p>
<span class=”shadow_container”>Buy CC Alumni Wine<span class=”shadow_text”><a href=”http://store.vintagespec.com/cocovi.html” target=”_blank”>Buy CC Alumni Wine</a></span></span> <!– #EndLibraryItem –></div>
</div>
<!–/Nav–>

<!– News–>
<div class=”newsBorder”>
<div class=”news”>
<span class=”newsHeader”><span class=”shadow_container”>Other Events<span class=”shadow_text”>Other Events </span></span></span>

<p><span class=”shadow_container”><strong>Test Event</strong><span class=”shadow_text”><strong>Test Event</strong></span></span></p>

</div>
</div>

<!– /News–>

<!– MainTop

<div class=”mainTop”>–>

<div class=”photoTitle”>
2006 <span class=”i874″>1874 Society</span> Black Tie Holiday Party
</div>

<!–<div id=”entireGallery”>–>
<ul>
<li>
<div class=”thumbnail”>
<img src=”blacktie_images/6937rev_thumb.jpg” alt=”Blacktie Event” width=”85″ height=”150″ /><br />
I’m a caption!
</div>
</li>

<li>
<div class=”thumbnail”>
<img src=”blacktie_images/6939rev_thumb.jpg” alt=”Black Tie Holiday Party” /> <br />
I’m a caption!
</div>
</li>

<li>
<div class=”thumbnail”>
<img src=”blacktie_images/6941rev_thumb.jpg” alt=”Black Tie Holiday Party” /> <br />
I’m a caption!
</div>
</li>

<li>
<img src=”blacktie_images/6945rev_thumb.jpg” alt=”Black Tie Holiday Party” /><!– <br />
I’m a caption!–>
</li>

<li>
<img src=”blacktie_images/6948rev_thumb.jpg” alt=”Black Tie Holiday Party” /><!– <br />
I’m a caption!–>
</li>

<li>
<img src=”blacktie_images/6950rev_thumb.jpg” alt=”Black Tie Holiday Party” /><!– <br />
I’m a caption!–>
</li>

<li>
<img src=”blacktie_images/6951rev_thumb.jpg” alt=”Black Tie Holiday Party” /><!– <br />
I’m a caption!–>
</li>

<li>
<img src=”blacktie_images/6952rev_thumb.jpg” alt=”Black Tie Holiday Party” /><!– <br />
I’m a caption!–>
</li>

<li>
<img src=”blacktie_images/6955rev_thumb.jpg” alt=”Black Tie Holiday Party” /><!– <br />
I’m a caption!–>
</li>
<!– this goes on for 43 images, but you get the drift… –>
</ul>
</div>

<!– other stuff you don’t need to see… –>
</body>
</html>
[/code]

I know that it looks weird, cuz I have divs in the list, but that just shows you, if you go to the page, what happens to the divs. It doesn’t work if i just have divs floated right… again, this is just firefox. any ideas? Thanks in advance,

PJ

to post a comment
CSS

12 Comments(s)

Copy linkTweet thisAlerts:
@WebJoelFeb 28.2007 — Okay, -so I have your code. I had to make all five-hundred images be "absolute path" so that they will display for me on my editor (on my desktop) for the purposes of testing this. Now, -what [I]exactly[/I] is not working right? Is something overlapping something else? I can't seem to see right off what is not correct... ?
Copy linkTweet thisAlerts:
@felgallFeb 28.2007 — Does it work properly in Opera and Safari? Usually all modern browsers process the CSS pretty much the same and it is only antiquated browsers such as IE7 that need patching.
Copy linkTweet thisAlerts:
@WebJoelMar 01.2007 — It's about enough to make me wanna go buy a MAC! :rolleyes: Don't you all just love those "Hi, -I'm a PC". "Hi, -I'm a MAC" commercials on tv... ?

-I think that I'm too tired to work on this any further tonight... ?
Copy linkTweet thisAlerts:
@HookedOnWinterauthorMar 01.2007 — Thanks for looking at this guys. I'll explain in more detail / post a screenshot tomorrow at work.

pj
Copy linkTweet thisAlerts:
@HookedOnWinterauthorMar 01.2007 — Ok, so I apologize for not being more clear last night.

I've attached two files, aptly named list.gif and div.gif. The lsit one is the one where all the pictures are list items, and are set to display:inline;. The div one looks better, is easier to control, however for some reason the news class is affecting it and making the divs start farther down the screen. Again, this happens in FF but not IE.

Any ideas?

[upl-file uuid=e299fa0c-be1d-4f25-8440-4cd49903640e size=94kB]list.gif[/upl-file]

[upl-file uuid=e98ffe6a-07b6-4f62-860d-1806305c1bac size=98kB]div.gif[/upl-file]
Copy linkTweet thisAlerts:
@WebJoelMar 01.2007 — Ok, so I apologize for not being more clear last night.

I've attached two files, aptly named list.gif and div.gif. The lsit one is the one where all the pictures are list items, and are set to display:inline;. The div one looks better, is easier to control, however for some reason the news class is affecting it and making the divs start farther down the screen. Again, this happens in FF but not IE.

Any ideas?[/QUOTE]
Based upon these two screenshots, it looks like the difference between [B]vertical-align:top;[/B] versus [B]vertical-align:bottom;[/B] even though you probably didn't state either of these two selectors/declarations-values. I don't think that they are starting farther down the screen, although it does appear that the DIV is following some command like margin-top: or is trying to clear some float..

If you click-hold & drag your pointer tool on the page itself (not the posted images), you should see that the <li>s are more-or-less the same, just populated more-or-less fully.

I would think that one browser handles <li> one way and the other browsers assume another. -Do you have a preferance? -Images aligned 'to the top' or images aligned 'to the bottom'? of the <li> or <div>. Or, would a middle vertical-centering be more pleasing?

I myself would think vertical alignment towards the top looks better than towards the bottom of each 'container' (in this case, "<li>", and it would better accomodate any "text" underneith), but if any image were 'centered' in the <li>, that might look balanced too in a truer 'photo-album' kind of way...

-Any thoughts?
Copy linkTweet thisAlerts:
@HookedOnWinterauthorMar 01.2007 — The div screenshot is actually completely void of list tags.. here:

<i>
</i>&lt;div class="thumbnail"&gt;
&lt;img src="blacktie_images/6937rev_thumb.jpg" alt="Blacktie Event" width="85" height="150" /&gt;&lt;br /&gt;
I'm a caption!
&lt;/div&gt;

&lt;div class="thumbnail"&gt;
&lt;img src="blacktie_images/6939rev_thumb.jpg" alt="Black Tie Holiday Party" /&gt; &lt;br /&gt;
I'm a caption!
&lt;/div&gt;

&lt;div class="thumbnail"&gt;
&lt;img src="blacktie_images/6941rev_thumb.jpg" alt="Black Tie Holiday Party" /&gt; &lt;br /&gt;
I'm a caption!
&lt;/div&gt;

&lt;div class="thumbnail"&gt;
&lt;img src="blacktie_images/6937rev_thumb.jpg" alt="Blacktie Event" width="85" height="150" /&gt;&lt;br /&gt;
I'm a caption!
&lt;/div&gt;

&lt;div class="thumbnail"&gt;
&lt;img src="blacktie_images/6939rev_thumb.jpg" alt="Black Tie Holiday Party" /&gt; &lt;br /&gt;
I'm a caption!
&lt;/div&gt;




and so on.

so vertical-align shouldn't matter since they're not inline objects or anything. what else ya got? ;-)
Copy linkTweet thisAlerts:
@WebJoelMar 01.2007 — It's confusing to be sure. :o I seem to be working with the code that uses the <li> and you're working with the code that is devoid of them. In the screenshot, here is what happens. Note how the images are at 'the bottom' of the container ("<li>" in my example) and how the three 'text below image' which are above it, appear to be "block" because the highlight collapses around it... ?

[upl-file uuid=3059a0f3-bac1-42a3-8ca1-d42ec9b2a10e size=26kB]ScreenHunter_3.jpg[/upl-file]
Copy linkTweet thisAlerts:
@HookedOnWinterauthorMar 01.2007 — I'm being confusing, that's why. whoops!

ok, so here's what happened. originally, with the first post, i had divs in <li>s, but now they're gone, it was the same problem either way, but the li's were just extra code... so, if you refresh http://www.coloradocollege.edu/giving/1874/events/blacktie.htm, it should be the code i'm working with, the one i just posted. sorry for the confusion. i tend to change a lot of stuff in between posts (for example, i just added a js photo gallery thing to the first three pictures)
Copy linkTweet thisAlerts:
@HookedOnWinterauthorMar 01.2007 — I can fix the problem by getting rid of the bottom box ("Other Events"), or if I get rid of the line:

<i>
</i>.newsBorder{
clear:left;
}


However then that box floats up and left and screws up everything... so I'm pretty sure that clear:left; is what's killing me here, I just don't know a) how to fix it or b) why IE is ignoring it and FF is screwing up my site... hmmm
Copy linkTweet thisAlerts:
@HookedOnWinterauthorMar 01.2007 — ok, so i got it to work by putting the entire left nav area in a div, floating that left, and setting a max-width so that the second area would drop down without having to set it to clear. here's the code to compare to the first one if anyone's interested. Thanks for the help! ?

<i>
</i>/*nav for event pages*/
.navEvent {
font-size:large;
}

.navEvent, .event {
top:2px;
left:2px;
width: 140px;
background-color:#bb8410;
margin:2px;
padding:5px;
color:#FFFFFF;
}

.eventBorder{
position:relative;
margin-top:10px;
margin-bottom:50px;
}

.navEventBorder, .eventBorder{
border:thin solid #bb8410;
float:left;
}

.eventStuff{
position:relative;
max-width:200px;
float:left;
}

/*and the thumbnail divs*/
.thumbnail{
float:left;
width: 140px;
height:200px;
text-align:center;
margin:0 2px 20px 2px;
overflow:hidden;
color:white;

}
Copy linkTweet thisAlerts:
@WebJoelMar 05.2007 — Here is a simply CSS photo-gallery from my archives:

<!doctype html public "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

<head>

<title> New Document </title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<meta name="Generator" content="" />

<meta name="Author" content="" />

<meta name="Keywords" content="" />

<meta name="Description" content="" />

<style type="text/css">

* {margin:0; padding:0; border:0;} /* Re-sets IE to "zero" for these values */

body {min-height:100%; height:100%;

font:x-small Arial, Verdana, sans-serif;

voice-family: ""}"";voice-family:inherit;

font-size:small;/*
for IE 5.5 */

} html>body {font-size:small;}

/*
font-size: small; voice-family: ""}"";

voice-family: inherit; font-size: medium;*/} /* Assist IE rendering height, keyword-font sizes, etc. */

p {font-size: 90%; line-height:1.2em; margin-top:6px;}

h1, h2, h3, h4, h5, h6 {font-family: 'times new roman', arial, verdana, serif;

font-style:normal; font-variant:normal; font-weight:normal; margin:11px 0 0 10px;}

h1{font-size: 1.93em; margin-top:12px;}

h2{font-size: 1.72em; margin-top:12px;}

h3{font-size: 1.52em; margin-top:12px;}

h4{font-size: 1.42em; margin-top:12px;}

h5{font-size: 1.32em; margin-top:12px;}

h6{font-size: 1.21em; margin-top:12px;}

ul#photobook {position:relative; width:650px; margin:70px auto; list-style-type:none;

font-family:arial, verdana, serif; border:5px double silver;}

ul#photobook h1 {position:absolute; left:105px; top:-55px; width:450px; margin:20px auto; text-align:center; border:3px double silver; border-bottom: 0 none;}

ul#photobook li {float:left; margin:7px;}

ul#photobook li p {text-align:center; margin:5px 0; width:140px; height:30px;}

.clear {clear:all;}

</style>

</head>

<body>

<ul id="photobook">

<li><img src="#" height="80" width="144" alt=""/><p>L. Ips. Dolar</p></li>

<li><img src="#" height="80" width="144" alt=""/><p>Lorem Ipsum Dolar your visible descriptive text</p></li>

<li><img src="#" height="80" width="144" alt=""/><p>Lorem Ipsum Dolar </p></li>

<li><img src="#" height="80" width="144" alt=""/><p>Lorem Ipsum Dolar your descriptive text</p></li>

<li><img src="#" height="80" width="144" alt=""/><p>Lorem Ipsum Dolar your visible descriptive text</p></li>

<li><img src="#" height="80" width="144" alt=""/><p>Lorem Ipsum Dolar your descriptive text</p></li>

<li><img src="#" height="80" width="144" alt=""/><p>Lorem Ipsum Dolar </p></li>

<li><img src="#" height="80" width="144" alt=""/><p>Lorem<br />Ipsum Dolar</p></li>

<li><img src="#" height="80" width="144" alt=""/><p>Lorem Ipsum text</p></li>

<li><img src="#" height="80" width="144" alt=""/><p>Lorem Ipsum Dolar your descriptive text</p></li>

<li><img src="#" height="80" width="144" alt=""/><p>Lorem Ipsum text</p></li>

<li><img src="#" height="80" width="144" alt=""/><p>Lorem Ipsum Dolar your descriptive text</p></li>

<h1>An all-CSS photo-image photobook</h1>

</ul>

<div class="clear"><!-- required --></div>

</body>

</html>[/QUOTE]
Noteable are the LACK of container-DIVs, the shortness overall of the code, -make the cintainer DIV be a % and it is re-sizing for screens of reduced width (images will drop to ine below, etc).

With a very short change of the code that governs the "<span>Text</span>", you can either have descriptive text always-visible ([I]as here[/I]), or [I]hidden[/I] and reveal on-hover over each image...

-Thought you might like this. ?
×

Success!

Help @HookedOnWinter spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...