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 4238306
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:53:15+00:00 2026-05-21T02:53:15+00:00

In a basic block of html the top padding of the H1 element appears

  • 0

In a basic block of html the top padding of the H1 element appears to be in relation to the H1 element above it and not the P element right above it.
Since I have a varying amount of P elements I can’t use their bottom padding to control the position of the H1 element below, without affecting the spacing between each P element.

How do I get the H1 element to pad relative to the P above it?

<h1>heading</h1>
<p>text text</p>
<p>text text</p>
<h1>heading</h1>
<p>text text</p>
<p>text text</p>
<h1>heading</h1>
<p>text text</p>
<p>text text</p>

Here is my CSS, which seems would create 27px between the bottom of the P element and the top of the H1 element.

p {
float: left;
font-size: 12px;
line-height: 15px;
padding: 0px 0px 12px 0px;
}

h1 {

font-size: 22px;
line-height: 22px;
font-weight: 200;
padding: 15px 0px 20px 0px;
margin: 0
}

Currently there is 12px of padding from the bottom of the P element to the top of the H1, and increasing the padding on the top of the H1 element does not increase the space between the P and the H1, but it does increase the space between the top of the H1 and the bottom of the H1 above it.

It is as if the H1 element ignores the properties of the P element and only reacts to the H1 above it.

  • 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-05-21T02:53:16+00:00Added an answer on May 21, 2026 at 2:53 am

    Why are you floating your paragraphs but not your headers?

    Margins behave differently when applied to floats, particularly in IE7 and below. Unless you have any real reason to float the paragraphs, don’t!

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

Sidebar

Related Questions

I have a basic unordered list in HTML/CSS as follows... <div class=floatleft> <ul class=help>
I have a block of HTML that I would like to use as the
Here's a puzzle. Basic page, one element: http://jsfiddle.net/PZj6t/ HTML: <div id=container></div>​ CSS: body, html
I have an img html block <img src=folder1/folder2/folder3/logo1.png> positioned inside a big div like
Apologies, this is pretty basic. I have abstracted my static html navigation bar to
I have a page with some very basic examples that use HTML/CSS/JavaScript. I'd like
I have a basic html page, and i want the show a virtual card
Basic C# syntax question: So I have this class public class BrandQuery<T> : Query<T>
basic c++ question i'm fairly sure. if i have a base class with a
Basic question! I have 2 tables PRODUCE +-----+--------------+ | id | fruit_name | +--------------------+

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.