How to vertically align data in the center of a table cell in HTML?


Tags: html,css,design

Problem :

I have a HTML table with two rows and two cells in each row.
Cell 1 in each row has an img (same in every row)
Cell 2 in each row has some text (different in every cell)

When I load it to server it shows up like the image (cell 1) is aligned to the top and the text (cell2) is lower than the lower edge of an image. Here is the link, so you can check, really sorry, I'm not spamming. Please let me know how to fix this, as I've tried valign property for table, vertical-align CSS property, cellpadding, smaller font, smaller image etc - always get same result.

http://cladposters.com/



Solution :

You should make that thing into li's.

HTML:

<ul class="usps">
  <li>Denver’s Only LOCAL Ad Posting Service.</li>
  <li>Your first week of ad posting is FREE!!!  We are that confident of our ability to post LIVE Ads for your firm!!!</li>
  <li>etc</li>
</ul>

CSS:

ul.usps { list-style-image: url('checkbox.png'); }

For you question:

That's because you have set the vertical-align wrong (baseline). This alignes the stuff to the baseline of the parent element.


    CSS Howto..

    How can I get the font size of an element as it was set by css

    How to hide a div with jquery or alternative?

    How do I specify a css margin-top for foundation row div?

    How to place several elements in one row when using a list?

    How to make a css keyframe step animation responsive?

    in html and css how to get the box space to be smaller? [closed]

    How to create a header.php and footer.php with CSS files?

    How can `animation-play-state` in CSS be initially set to `paused` and changed to `running`?

    How to increase the distance between table columns in html?

    How can I wrap lines of text in an unordered list?

    iphone - How to implement the effect of “float” for image, just like in CSS style

    How to flip an image horizontally halfway through an animation

    How to move some text down in a li tag?

    How to do automatic reload of page when viewed in iPad Portrait mode?

    How to fade in and fade out text on a timer using css animations

    How do I use jQuery to change the value of a css selector value?

    How to fix a double click on a jQuery slide up/down animation?

    CSS - How can I push the submenus to the left?

    How to correctly redefine the CSS settings for FireFox?

    How to avoid div width increase on hover

    How can I control when my css transitions happen and when they don't?

    cannot figure out how to make text appear inside div after hover animation

    How to handle CSS code in my Android email app?

    How to keep responsiveness while expanding div background height in CSS?

    How to fix content leaks out of an element despite use of “overflow:hidden”?

    IE11: How to prevent sprite animating to correct co-ords

    How to apply an opacity without affecting a child element with html/css?

    How to add static files using Spring MVC and Thymeleaf

    How do I put 2 columns beside each other

    How to replace cycle('float: left', 'float: right') to use pure css?