0

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>
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Joebhoy Designs
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.