Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8318851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:07:22+00:00 2026-06-08T22:07:22+00:00

Ok, I am quite new to frontend development so please be nice if this

  • 0

Ok, I am quite new to frontend development so please be nice if this is a dumb question 🙂

I understand that this may not be possible but when applying line-height to an element say an h1, the line-height applies extra space to both the top and bottom of that element.

This kind of makes sense, but i only want line-height to be applied to the bottom of the element so the tops of my h1, h2 etc can be alined perfectly with other elements.

This jsfiddle shows the problem: http://jsfiddle.net/zja4c/1/

This jsfiddle shows what i want to achieve but am forced to use negative margins: http://jsfiddle.net/25UTA/

The h1 with background colour of red aligns correctly to the top of the left div, but the text doesnt.

My question is therefore, is there a way to:

  1. Apply line-height to only the bottom of an element or,

  2. Align an element to the top of the space created by applying line-height somehow

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T22:07:24+00:00Added an answer on June 8, 2026 at 10:07 pm

    Using line-height is your only option if you wish to maintain proper spacing across line-breaks. Padding will occur on the bottom of the block-level H1 element, as you pointed out. I think negative margins are your best bet, but you’ll have to fine-tune it line up perfectly with a 50px line-height:

    http://jsfiddle.net/25UTA/1/

    If negative margins can’t be used for some reason, you can use relative positioning and a negative top value to achieve a similar effect.

    http://jsfiddle.net/25UTA/2/

    Using em‘s or percentage font-sizes and line-heights might make this eaiser.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Quite new to this but i have created a SQL script that groups by
This has bothered me for quite a while, but now it is necessity that
Quite new to RIA Services but i am progressing... I noticed that some methods
im quite new to android, so i apologise if this is a noob-ish question
Quite new to coding for android but this issue has me tearing my hair
Im quite new to stackoverflow so I dont know if this question has been
Still quite new to Python. I have a problem similar to this question .
I'm quite new to EF, and I'm not really sure how to do this.
Scenario: Quite new to DI and Ninject but would love to master it so
I'm quite new to CSS / HTML, and can't find the cause of this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.