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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:28:17+00:00 2026-06-11T12:28:17+00:00

I have been learning HTML/CSS with codecademy, and I have this problem with my

  • 0

I have been learning HTML/CSS with codecademy, and I have this problem with my CSS border. I need my h1 to be centered with a border, but I don’t want that border to go to the ends of the page. Here is my code

<h1 style="color:#0034ff; padding:20px; border-style:ridge; border-width:5px; text-align:center;">HTML Testing Page</h1>

I plan on making a seperate style sheet soon, I just put the CSS in the HTML document to test it. This border goes to the ends of the page, and if I put display:inline or display:inline-block my text is no longer centered. How could I make the border just go next to the text without sacrificing centered text?

  • 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-11T12:28:18+00:00Added an answer on June 11, 2026 at 12:28 pm

    Indeed, the h1 is a block element, but I think you are looking for this:

    h1 {
        color:#0034ff;
        padding:20px;
        border-style:ridge;
        border-width:5px;
        margin: 0 auto; /* <--- */
        display: table; /* <--- */ 
    }​
    

    This will center the heading without it taking the entire width of the parent.

    http://jsfiddle.net/rm3Fk/11/

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

Sidebar

Related Questions

I have been learning css & jquery. <!DOCTYPE html> <html> <head> <style type=text/css> #box
I'm not a very experience programmer and have been learning HTML/CSS/JS on the fly.
I have been hearing so much about Sencha Touch HTML/CSS/JQuery things. I want to
I have been learning RESTful webservices following this tutorial http://www.vogella.de/articles/REST/article.html . As I understand,
I have been learning about Delegation and Data Sources for iOS programming and need
I have been learning python for some time now. While starting this learning python
I've just recently started learning HTML/CSS and I've been trying to teach myself sound
I've been working on website recently and have come across a major problem :http://jimbob.webatu.com/index.html(you'll
Quick question: I have been learning ruby on rails and http://guides.rubyonrails.org/index.html is really good
I have been learning NodeJS recently. It seems to be standard in the Node

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.