DIV-lemma
Warning: I didn't get much sleep last night, so the brain is fuddled...
I'm trying to get two s to show aside each other. Sorta like this:
______________________________________
| div1 | div2 |
| | |
| | |
| | |
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
This is easily achievable with the use of tables, but I want to try to minimise that this time.
So far, I've managed to use float:left|right to get something that looks like this:
______________________________________
| div1 | div2 |
| | the content text |
|‾‾‾‾‾‾‾‾‾‾‾‾ |
| wraps around here |
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
So... what am I missing? How would I make div1 span 100% in height, as though it were an adjacent cell in a table?
I hope I made some sense...
All comments and suggestions welcome.
Abhishek Reddy posted this at 18:43 — 28th November 2002.
He has: 3,348 posts
Joined: Jul 2001
Well, whaddya know. I think i fixed it.
Put my two s inside another with display:inline-block. Seems to work fine so far...
Suzanne posted this at 18:46 — 28th November 2002.
She has: 5,507 posts
Joined: Feb 2000
First, float and clear are your friends. Float the left one left and the right one right. Depending on which one is going to have more content, clear one side or the other.
It works to make it so they are like side-by-side table cells.
Suzanne posted this at 18:47 — 28th November 2002.
She has: 5,507 posts
Joined: Feb 2000
Or nesting, but that's still being presentational instead of structural or semantic -- try it without the nesting.
** I'm not saying it's wrong, just that I personally subscribe to the idea of the semantic web.
Abhishek Reddy posted this at 18:56 — 28th November 2002.
He has: 3,348 posts
Joined: Jul 2001
Thanks for replying.
It isn't just the text-wrap that is a problem. I also have similar setups repeating one below the other. I used the same #id for each with the same formatting, so when I apply float:left|right, they end up trying to float to the previous "row", as it were.
Easiest way out was nesting. I'll try again without nesting.
Suzanne posted this at 19:03 — 28th November 2002.
She has: 5,507 posts
Joined: Feb 2000
... you have the same #id twice on the same page? No can do, buckaroo!
Busy posted this at 20:36 — 28th November 2002.
He has: 6,151 posts
Joined: May 2001
.left {
float: left;
text-align: left;
color: #fff;
width: 50%;
}
.right {
float: right;
text-align: right;
color: #fff;
width: 50%;
}
and for the actual display:
left section left
right section right
and if you make the width on the main display under, say half, use something like or in a div as you can have other stuff trying to go beside it.
If you want the content center, change the text-align: in the style to center or remove it
Abhishek Reddy posted this at 21:32 — 28th November 2002.
He has: 3,348 posts
Joined: Jul 2001
Thanks, Busy.
That's pretty much what I already got...
But what does do? Is it not the same as a ? I don't think I follow.
Abhishek Reddy posted this at 00:12 — 29th November 2002.
He has: 3,348 posts
Joined: Jul 2001
Add note: the problems with the overlapping s came down to sloppy coding — missed ; and units etc. Works now without nesting.
Busy posted this at 01:07 — 29th November 2002.
He has: 6,151 posts
Joined: May 2001
its works more if your using multi float div's but its like saying "anything above this has to stop here" so the above can't "flow" into lower sections
hope that explains it, it's kind of one of those things that just is lol
Suzanne posted this at 02:44 — 29th November 2002.
She has: 5,507 posts
Joined: Feb 2000
Using a for that is still presentational markup, but it does work (did it myself until recently when I finally got the whole thing straight in my head and moved to XHTML 1.0 Strict).
The folks chit-chatting at CSS-Discuss go over and around this issue a lot -- whether to use hacks in the markup v. hacks in the CSS and how lamentable that hacks are still required, even though they are so much smaller and more efficient hacks now.
Abhishek Reddy posted this at 03:05 — 29th November 2002.
He has: 3,348 posts
Joined: Jul 2001
I'm shocked: my first attempt at XHTML & CSS and the page validated to XHTML Strict 1.0! :eek:
Suzanne posted this at 03:21 — 29th November 2002.
She has: 5,507 posts
Joined: Feb 2000
WHOOOO!!! Way to go!
Abhishek Reddy posted this at 03:34 — 29th November 2002.
He has: 3,348 posts
Joined: Jul 2001
heh thanks.
Now I just have to get the CSS all validated and ready to go.
After one night of CSS, I can't imagine how I ever put up with nested tables. Creating this single page took me less than half the time it would've taken me with HTML4. And it's better looking too. Even compatible with 3 browsers - IE6, O6, NS6 (I'll post it up for compatibility testing soon).
Edit: CSS passed too. Oooo I'm feeling all warm and fuzzy.
Busy posted this at 04:28 — 29th November 2002.
He has: 6,151 posts
Joined: May 2001
Congrats dude, drinks are on you
The Webmistress posted this at 08:27 — 29th November 2002.
She has: 5,586 posts
Joined: Feb 2001
Can't wait to see the page, might even spur me on to try
Abhishek Reddy posted this at 08:53 — 29th November 2002.
He has: 3,348 posts
Joined: Jul 2001
For a limited time only: http://210.54.113.176/public/DEV/C3S/C3S.php
Hurry before my IP changes. (I need a more permanent PHP host. Desperately. )
The design isn't all that flashy, but it works ok. The content is just documentation-type stuff.
I took up Busy's idea of a graphic-less site and avoided using titles/banners and the like in graphical format. Kept it to a minumum.
My stylesheets are a bit messy, but they validate. Right now, I'm playing around with alternate stylesheets — Print Friendly, etc.
The content itself is just something a friend and I developed over time for fun. If you have a few minutes to kill, this'll waste your time nicely.
Busy posted this at 09:12 — 29th November 2002.
He has: 6,151 posts
Joined: May 2001
Thats great (did you set a background color?)
puts my graphic less thing to shame
^9
The Webmistress posted this at 09:15 — 29th November 2002.
She has: 5,586 posts
Joined: Feb 2001
So is this the way forward with graphicless sites?? Not to say that either of yours aren't good but isn't is going to get boring without graphics?
Abhishek Reddy posted this at 09:21 — 29th November 2002.
He has: 3,348 posts
Joined: Jul 2001
Oh not at all. I'd love to have used graphics, but the content style wouldn't suit it. This is meant to be more like a php.net or w3.org page... just plain old content-oriented documentation.
For most other concepts, I would've used much more imagery.
Busy posted this at 09:24 — 29th November 2002.
He has: 6,151 posts
Joined: May 2001
I did mine cause am trying to keep the bandwidth down, but I am tiring of slow loading graphics, esp flash and slow loading pages, downfalls of 56k.
msn (hotmail) is even using the marquee tag now, real annoying.
Maybe we could start a new trend, I know of a few other people working on graphic-less sites
The Webmistress posted this at 09:41 — 29th November 2002.
She has: 5,586 posts
Joined: Feb 2001
Try selling that concept to clients who want every picture of every products plus ones of the office and anything else they can come up with and then on top of that animated gifs, flashy useless flash and funky layout designs!!!
Julia - if life was meant to be easy Michael Angelo would have painted the floor....
Busy posted this at 09:46 — 29th November 2002.
He has: 6,151 posts
Joined: May 2001
I know, remember that quad adventure site I did, they want a animated bike running over the page *Sigh* hopefully can talk them out of it. am glad webpagesthatsuck are around
Abhishek Reddy posted this at 10:12 — 29th November 2002.
He has: 3,348 posts
Joined: Jul 2001
Clients aren't minimalists. I don't think you should even think about selling graphicless sites.
Renegade posted this at 10:45 — 29th November 2002.
He has: 3,022 posts
Joined: Oct 2002
my earliest site were graphicless! lol aye abhi! hehe but thne again i didn't know how to markup that well :S i'm think i'll start do join the trend ...
dk01 posted this at 12:33 — 29th November 2002.
He has: 516 posts
Joined: Mar 2002
Hey Abhishek when you get a chance could you attach your code. I have been doing css now too any would like to see it. Thanks.
-dk
Abhishek Reddy posted this at 12:37 — 29th November 2002.
He has: 3,348 posts
Joined: Jul 2001
k, you want the stylesheet or the whole thing?
sitebug.com/C3S/
You can get the stylesheets there in /styles. .phps added.
Suzanne posted this at 14:28 — 29th November 2002.
She has: 5,507 posts
Joined: Feb 2000
About going entirely without graphics -- I think it's a horrible idea in general, however, there are many many good publications out there that don't use graphics for most of the page elements, only illustrations for articles and such.
Robin Williams explains the use of colour on a page (black and white, weights of text and such, not red, blue, yellow kinds of colour) really well: http://www.eyewire.com/magazine/columns/robin/blacknwhite/
Now back to your regularly schedule glee at CSS/XHTML that works!
Abhishek Reddy posted this at 23:37 — 29th November 2002.
He has: 3,348 posts
Joined: Jul 2001
I suppose there's also the question of just what a graphic is...
It doesn't strictly have to be a "graphic file". For example, on the page I made, I use divs and text with a bit of formatting - and that serves sufficient eye candy. ATM, there's no need to do any more for fear of over-doing it as it works fine the way it is.
Then again, this isn't a whole site as such. It's a single document, so I can get away with sending the jpgs and gif on holiday.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.