is it possible to align text vertically within a div just using css class?
I saw this tutorial on the web which are compatible with IE but wish to avoid the span.
but cant make it to work. need some advice :)

<style>

  p.demo {
    border: 1px solid black;
    height: 200px;
    margin: 1.25em auto 0;
    width: 200px;
    }

 
  </style>
<!--[if lte IE 7]><style>

  .demo span
{
    display: inline-block;
    vertical-align: middle;  /*needed for the horizontal menu since
                               it's not inherited in this case*/
    }

  .demo b
          {
    display: inline-block;
    height: 100%;
    vertical-align: middle;
    }

  

</style><![endif]-->

</head>

<body>

 <p class="demo"><span>Centering multiple lines
        <br />
        in a block container.</span>  <!--[if lte IE 7]><b></b><![endif]--></p>
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.