Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

58 users online



CSS/div FAQ

CSS/div FAQ

Currently viewing this thread: 1 (0 members and 1 guests)


Page 1 out of 3
Rad

Rad

thinking of something witty to put here
Status: Offline!

CSS/div FAQ

How do I make a div that stretches the height of the page (100% height)
This question is asked very often. The answer is at QuirksMode.

How do I horizontally center a div?
The code is relatively simple.

Code:

/* body can be replaced with the
parent of the object you want to center */
body {
text-align: center; /* IE5.x/Win fix */
}

#center {
text-align: left; /* reset text aligning */
margin: 0 auto; /* the correct way */
/* you can modify the top and bottom margins, just leave left and right to auto */
}

How do I vertically center a div?
This gets a little more complicated. The answer is at WPDFD (just ignore the stuff about horizontal centering)

Note: You must use a HTML doctype (not XHTML) or else it screws up IE5/Mac. Go figure. Update: You can use a hack to hide it from IE5/Mac. See below link.

How do I completely center a div
http://www.hicksdesign.co.uk/articles/css/vertical_centering_with_css/

How do I make a fluid header column? (Ynhockey Smile)
Easy. Just use float: left and the column magically shrinks to the size of the contents.

Code:

#elastic {
float: left;
}

How do I change scrollbar colors?
You don't. Actually, it's very possible, but not reccomended at all. Scrollbar colors annoy people, are non standards compliant, and are IE-only.

What's wrong with tables?
I won't go into depth, as this is a very big topic to discuss, and I'll just provide a short summary.

Tables weren't meant to be used for non-tubular data, so they shouldn't be. They also leave your pages unsemantic and unusable, which is a no no. You'll also be able to redesign your site with much more flexibility and speed.

Off Topic: How does your signature work?
My signature uses simple browser detection using PHP and reads the correct image based on the browser.

This will be updated further...

Last edited by Sykil, June 17th, 2005 04:02 AM (Edited 3 times)

Sykil

Sykil

Neversidian
Status: Offline!

Smile This should be helpful! Thanks Radley!

___________________

http://imagegen.last.fm/artist/artists/Sykil.gif

jadedchron

jadedchron

Neverside Newbie
Status: Offline!
Quote:

Originally posted by Radley

Tables weren't meant to be used for tubular data, so they shouldn't be.

...

___________________

Nick
Pixel-Infinity

reregistered

reregistered

Neverside Newbie
Status: Offline!
Quote:

How do I vertically center a div?
This gets a little more complicated. The answer is at WPDFD (just ignore the stuff about horizontal centering)

this will only work on a mac if you use a:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
doctype - anything more and it fails

MrKill

MrKill

I'm the best and worst at everything !
Status: Offline!

i dont get <div>'s Sad

is it just me?

___________________

400MB space | 5GB bandwidth | free domain name | PHP/MySQL | $4.95/mo

OMG WHATS THIS?!?!?!?!?

freak

freak

Neverside Newbie
Status: Offline!
Quote:

Originally posted by Mr.Kill
i dont get <div>'s Sad

is it just me?

What's there to "get" about them? A <div> is just a generic block level element. What you do with it with CSS might make it a little more confusing, though.

Just go through some CSS tutorials and you should get the hang of it, most of it is self explanatory. And, if you have any specific questions, just post a new thread.

// freak

___________________

Tables for layout is an abuse. -- Internet Explorer is unsafe.

Last edited by freak, March 14th, 2004 01:01 PM (Edited 1 times)

Rad

Rad

thinking of something witty to put here
Status: Offline!
Quote:

Originally posted by reregistered
this will only work on a mac if you use a:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
doctype - anything more and it fails

I hadn't realized that at the start and I wasted a lot of time to figure out. Browsers are stupid.

Phil

Phil

with Mr. Jones
Status: Offline!

As requested... plus this is useful.

___________________

http://www.philbrodeur.com - Expert PHP Development and Tutorials

Rad

Rad

thinking of something witty to put here
Status: Offline!

Fixed the typo, thx jaded.

CokeFreeV

CokeFreeV

Status: Offline!

I have a question. Without tables, how can you make a layout where DIVs are next to each other?

Example:
_______________
| 1st div | 2nd div |
|______| _______|

Page 1 out of 3
Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0191 seconds.