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

  • Home
  • SEARCH
  • 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 6191987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:52:00+00:00 2026-05-24T02:52:00+00:00

A bit new to styling sheets. I have a div for my site’s content.

  • 0

A bit new to styling sheets. I have a div for my site’s content. I’ve aligned my h1 to be in the middle of that div by using the margin-right property. When I use the margin-right property on the p tag within the same div, however, it also affects the h1 and moves that further left. I figure I shouldn’t be using margin-right, but what is the best way to do this?

Please let me know if my question is unclear.

HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head>
<link rel="stylesheet" type="text/css" href="style1.css" />

<title>
Putnam County Family Support Services - Resources
</title>

</head>

<body>

<div id="container">

    <div id ="top">

    <center><img src="images/logo1.jpg" alt="logo" /></center>


    </div>


    <div id="navigation">

        <ul>

        <li><a href="index.html" onMouseOver="document.MyImage4.src='images/home_nav1.jpg';" onMouseOut="document.MyImage4.src='images/home_nav.jpg';"> 
        <img src="images/home_nav.jpg" name="MyImage4"></a> </li>

        <li><a href="services.html" onMouseOver="document.MyImage3.src='images/services_nav1.jpg';" onMouseOut="document.MyImage3.src='images/services_nav.jpg';"> 
        <img src="images/services_nav.jpg" name="MyImage3"></a> </li>

        <li><a href="resources.html" onMouseOver="document.MyImage2.src='images/resources_nav1.jpg';" onMouseOut="document.MyImage2.src='images/resources_nav.jpg';"> 
        <img src="images/resources_nav.jpg" name="MyImage2"></a> </li>

        <li><a href="staff.html" onMouseOver="document.MyImage1.src='images/staff_nav1.jpg';" onMouseOut="document.MyImage1.src='images/staff_nav.jpg';"> 
        <img src="images/staff_nav.jpg" name="MyImage1"></a> </li>

        <li><a href="contact.html" onMouseOver="document.MyImage.src='images/contact_nav1.jpg';" onMouseOut="document.MyImage.src='images/contact_nav.jpg';"> 
        <img src="images/contact_nav.jpg" name="MyImage"></a> </li> 

        </ul>


    </div>

    <di id="content">

    <h1>Contact</h1>

    <p>Address: 22 West Washington Street<br />Greencastle, IN 46135</p>

    <p>Phone number:</p>


    </div>


    <div id ="footer">



    </div>

</div>



</body>
</html>

CSS:

body {
background: #f3f6f3;
text-align: center;
}

#container {
color: #1e337a;
width: 650px;
margin: 0 auto;
}

#top {
padding-bottom: 25px;
}

#navigation {
float:left;
position: absolute;
}

#navigation ul {
list-style: none;
padding-top: 20px;
}

#navigation ul li {
padding-bottom: 20px;
margin-right: 40px;
}

#content {
float: right;
border: 1px;
}

#content h1 {
margin-right: 175px;
}

#content p {
margin-right: 170px;
}


#footer {
clear: both;
font-size: 12px;
}
  • 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-24T02:52:01+00:00Added an answer on May 24, 2026 at 2:52 am

    Try using percentages rather than absolute values to place items, to center an inline block element (if the element width is set) you can use : margin-right : auto; margin-left: auto;

    To center your H1, you should use the property :

      #content h1 {
    text-align: center;
    }
    
    #content p {
    text-align: left;
    }
    

    this centers your text, have a look here

    It would be quite handy if I could have a look at your HTML as well.

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

Sidebar

Related Questions

I have a bit of code that looks like this: text = reg.Replace(text, new
The following bit of code catches the EOS Exception using (var reader = new
I'm a bit new to the whole rebasing feature within git. Let's say that
a bit new to programming and had a general question that I just thought
I am lil bit new to objective C. Here is my requirement. I have
I'm a bit new to subsonic (i.e. evaluating 3.0.0.3) and have come across a
I'm a bit new to SSRS... I have an MVC3 application which I need
I am a bit new at C# and I have run into a string
A bit new with WPF...It seems like not matter what I change with horizontal
I am a bit new to Perl, but here is what I want to

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.