Forum Moderators: not2easy

Message Too Old, No Replies

Can Someone Help Me Simplify This Layout? (I'm an idiot)

         

duderdude2

6:49 pm on Mar 23, 2005 (gmt 0)

10+ Year Member



I'm still new to CSS and I'm having trouble simplifying my layout. Right now, I'm using absolute positioning and it's resulting in a mess of coding for some of my pages.

Specifically this one:
[gamexplain.com...]

Here's the CSS I'm using for it all of the pictures and descriptions on that page:
[gamexplain.com...]

Is there a way I can have each individual item be self-contained so that I can simply list them without absolute positioning? Only thing is that I need the description box below the game image to continue to have an overflow:auto command so the boxes all remain the same length.

I think if someone were able to help me with the formatting, it may give me a better understanding of how it works. Of course, I don't know how much that's asking for, but I'll appreciate any help I can get.

Moby_Dim

7:17 pm on Mar 23, 2005 (gmt 0)

10+ Year Member



May be you are too CSS-addicted ;) why not to use a table in this case?

duderdude2

7:20 pm on Mar 23, 2005 (gmt 0)

10+ Year Member



Haha, fair enough.

The only problem is that, to my knowledge, I won't be able to have the text box (below the image) remain at a fixed height, so that way if the text is enlarged, a scroll bar will appear as opposed to extending the entire box's length. That's the main reason why I'm using CSS for it.

Am I right? I really don't know.

ronin

1:23 am on Mar 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You should be able to get rid of a lot of that css, by using float:left; and specifying the width of an individual box, instead of using absolute positioning.

If you have also specified the width of the container div, you won't need to specify when an individual box has to move down and start a new row, because, float:left; will do that automatically.

By specifying margins you will be able to create the desired amount of space around each individual box as well - and the distance between one row and the row beneath.

matthijs

6:34 am on Mar 24, 2005 (gmt 0)

10+ Year Member



Hi,
indeed, with floats you should be able to create the layout you want. Maybe this article is of some help:
[css.maxdesign.com.au...]
Off course, floats have their problems in IE, so check out [positioniseverything.net...]

duderdude2

7:43 am on Mar 24, 2005 (gmt 0)

10+ Year Member



Thanks matthijs and ronin, your links and suggestions were very insightful. However, so far as I can tell, the float command comes close to what i want, but not exactly.

Problem is that the "captions" below the "images" will vary in length, thus it would make my page look odd with a bunch of boxes of varying length. I got around this by having my current webpage's layout (the absolute:position one) use an "overflow" command on the "captions" area specifically so only that area scrolled, leaving the image stationary. But with float, it scrolls the entire box, which is not what I wanted.

Maybe I can't do what I want in a method other from what I've already done?

duderdude2

8:04 am on Mar 24, 2005 (gmt 0)

10+ Year Member



Never mind! I think I figured out how to do it with the floats! Woo, that feels good (yeah, yeah, it's a big accomplishment for me ;)

Anyways, thanks so much for the help, though I might be back with more questions later ;)

Edit: Yup, I have a problem. The border isn't appearing around my object in firefox. Any ideas why? Also in Firefox, the <br class="clearboth"> command isn't pushing the next line down far enough. Here's my code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<style type="text/css">
<!--

.game
{
float: left;
width: 151px;
height: 113px;
border: 1px solid #000;
}

.caption
{
float: left;
width: 151px;
height: 120px;
overflow: auto;
}

</style>
</head>
<body>

<div class="game"><IMG SRC="/images-videos/starfoxassault/level1.jpg">
<div class="caption">Fortuna: Special Flag Locations</B><p class="videotext">Find all 5 special flag locations in Fortuna with this video. If you find them all in every level, "Demon Sniper" is unlocked for VS Mode!</p></DIV>

</body>
</html>

[gamexplain.com...]

Moby_Dim

3:13 pm on Mar 24, 2005 (gmt 0)

10+ Year Member



what if you make the text scrollable? if the amount of the text does not fit, it may scroll on mouseover event, for example?

with no scrollbar I mean.

duderdude2

6:29 pm on Mar 24, 2005 (gmt 0)

10+ Year Member



I don't think I understand what you mean. It's is scrollable now?

Moby_Dim

6:41 pm on Mar 24, 2005 (gmt 0)

10+ Year Member



nope. the idea is : yiu may have any text u want in the fixed height/width box . If the user want to read it, he just fires some mouse event. text scrolls . no bars. the same size.

duderdude2

8:01 pm on Mar 24, 2005 (gmt 0)

10+ Year Member



I solved the problem. Thanks for the help everyone.