Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder stevenmw's Avatar
    Join Date
    Jun 2007
    Location
    OK
    Posts
    497
    Thanks
    27
    Thanked 31 Times in 31 Posts

    Top And Bottom Equal Height

    In order to center something using css usually a person will use

    Code:
    margin-left: auto;
    margin-right: auto;

    What I'm trying to do is make the space above and below my text to match. If I use a padding it expands my class which I want to be a specific height.


    How can I make space above and below my text without expanding the height of my div?

    Thanks.

  • #2
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts
    Quote Originally Posted by stevenmw View Post
    In order to center something using css usually a person will use

    Code:
    margin-left: auto;
    margin-right: auto;

    What I'm trying to do is make the space above and below my text to match. If I use a padding it expands my class which I want to be a specific height.


    How can I make space above and below my text without expanding the height of my div?

    Thanks.
    Is this what you need?

    Frank
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    What I'm trying to do is make the space above and below my text to match. If I use a padding it expands my class which I want to be a specific height.
    Try applying a line-height to that div, having the same value as that of the value applied for height
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •