Jump to content

Simple CSS div vertical align


johnsmith153

Recommended Posts

Are you taking the piss?

 

Put exactly this in html:

<div style="float:left;width:50px;height:50px;text-align:center;">hello</div>
<div style="float:left;width:50px;height:50px;text-align:center;">hello</div>
<div style="float:left;width:50px;height:50px;text-align:center;">hello</div>

 

And see if you can align them vertically.

 

Not with your crap certainly.

 

Vertical align meaning top to bottom, by the way, just incase you can't tell the difference between horizontal and vertical.

 

Link to comment
Share on other sites

ur a very rude person ur lucky i even bother with you

 

<div style="float:left;width:50px;height:50px;text-align:center;">hello</div>
<div style="clear: both"></div>
<div style="float:left;width:50px;height:50px;text-align:center;">hello</div>
<div style="clear: both"></div>
<div style="float:left;width:50px;height:50px;text-align:center;">hello</div>

Link to comment
Share on other sites

If you read the first post, it states I need to align vertically text, buttons etc. INSIDE the div.

("I just need to vertically align everything inside the div (images, text, buttons - anything inside)")

 

If you only read my second post I can uderstand why svivian and nadeemshafi9 were either confused or thought I wanted them stacked on top or some other method

 

Kyme is an idiot. Read my first post and his reply. He is obviosuly not trying to help. I appreciate all help, but this was a waste of time.

 

So if anybody can tell me how to align vertically 'inside' a div I do/will appreciate it.

 

vertical-align: middle doesn't work.

 

I need it to display like this

  xxxxxxxxxx  xxxxxxxxxx  xxxxxxxxxx

  x          x  x          x  x            x

  x  img    x  x          x  x    A    x

  x  img    x  x    A    x  x    A    x

  x  img    x  x          x  x    A    x

  x          x  x          x  x            x

  xxxxxxxxxx  xxxxxxxxxx  xxxxxxxxxx

 

As now, my code does this

  xxxxxxxxxx  xxxxxxxxxx  xxxxxxxxxx

  x  img    x  x    A    x  x    A    x

  x  img    x  x          x  x    A    x

  x  img    x  x          x  x    A    x

  x          x  x          x  x            x

  x          x  x          x  x            x

  xxxxxxxxxx  xxxxxxxxxx  xxxxxxxxxx

 

 

 

 

 

 

Link to comment
Share on other sites

Great, all done, thanks.

 

My final solution was to add line-height: and set the same value for line-height: as is set for height.

 

Also, for images and buttons, I needed to add   after them as they didn't respond otherwise.

 

Crazy, but it all works.

 

Thanks for all your help.

Link to comment
Share on other sites

  • 3 months later...

johnsmith153 is an ignorant, antisocial, turd munching useless waste of space. Go do some research for yourself shit for brains instead of asking questions for simple problems and then insulting nice people because you were too freaking dumb to write your question properly. Somebody should slap your dump arse you piece of shit!!!

 

Go crawl back into that hole you came out of fuckspawn!!

Link to comment
Share on other sites

  • 1 year later...

Hi.. I found the solution:-

 

When a div being float styled, vertical-align will not work. To solve this problem,

we need to add inner div for every div. Then set the inner div to style width, height, vertical-align,

and display as write below.

 

<div style="float:left;width:50px;height:50px;text-align:center;"><div style="width:50px;height:50px;vertical-align: middle;display:table-cell;">hello</div></div>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.