6 replies [Last post]
drychan
drychan's picture
Offline
Enthusiast
India
Last seen: 12 years 22 weeks ago
India
Timezone: GMT+5.5
Joined: 2008-06-10
Posts: 52
Points: 2

what is the diffrance between Align and float ?

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 8 years 15 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

text-align only affects

text-align only affects inline elements (text, images). There are three options: left, center and right.

Floats can be applied to both block and inline elements and causes surrounding content to wrap around the floats. Floats are also taken out of the document flow. With floats, there are only two options (other than none) - left and right.

vertical-align is obviously vertical, not horizontal.

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

drychan
drychan's picture
Offline
Enthusiast
India
Last seen: 12 years 22 weeks ago
India
Timezone: GMT+5.5
Joined: 2008-06-10
Posts: 52
Points: 2

align and float

thanks tyseen

i want to know basic diffrance...u r talking about text-aligment
i want to know when we write

and

then what is the diffrance.....

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 8 years 15 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

Don't use

Don't use align="left/right"; that attribute is deprecated - that's what CSS is for.

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

drychan
drychan's picture
Offline
Enthusiast
India
Last seen: 12 years 22 weeks ago
India
Timezone: GMT+5.5
Joined: 2008-06-10
Posts: 52
Points: 2

align and float

k...

i knw but whats the diffrace tell me......

Stomme poes
Stomme poes's picture
Offline
Elder
Netherlands
Last seen: 11 years 13 weeks ago
Netherlands
Timezone: GMT+2
Joined: 2008-02-04
Posts: 1854
Points: 378

Well, as he said, floats are

Well, as he said, floats are taken (partially) out of the document. When you used to do align=left or right, I'm pretty sure it didn't. Aligning in the old days was for moving blocks to the furthest edge of the inside of their containers, while text-align worked with inline elements. As Tyssen said, floats were made in CSS to work with both.

Initially floats were supposed to imitate this thing in print where, if there's an image to one side, the text of the article can kinda wrap around it. Floats were quickly used for positioning whole big chunks of pages.

I never used align since it was already deprecated before I started writing HTML, but from what I've seen, it simply moves block elements to one side, the other, or center. For modern block centering, give the block a width and margin: 0 auto; (the first number doesn't have to be 0, just means number for top-bottom margins... you can also set them manually like margin: 10px auto 20px, which is 10px top margin, auto on the sides, 20px bottom margin. Both sides must be "auto" for centering to work). I'm actually not sure how align=center centered things...

I'm no expert, but I fake one on teh Internets

drychan
drychan's picture
Offline
Enthusiast
India
Last seen: 12 years 22 weeks ago
India
Timezone: GMT+5.5
Joined: 2008-06-10
Posts: 52
Points: 2

Thanks

thanks a ton!

thanks for ur detail description..it really helps me.