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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:38:54+00:00 2026-05-27T15:38:54+00:00

I would like to achieve this presentation: The title with the red background is

  • 0

I would like to achieve this presentation:

enter image description here

The title with the red background is an H1 element. Currently, I achieve this presentation with this HTML code:

<h1><em>Some title</em></h1>

So, I wrap the title in an EM element (which is an inline element) and then style that element.

Live demo: http://jsfiddle.net/jZeVw/

This works but I would be happier if I weren’t forced to use such a proxy element to style my H1 title. So, I would like to have this HTML code:

<h1>Some title</h1>

and the above presentation should be achieved with CSS alone. Can that be done?

Important: There must exist a 3px padding to the left and right sides od the title text and this space must be filled with the desired background color (red, in this case).

Also, the solution is not required to work in IE8 or other backward browsers. I’m fine if it works in the latest Firefox, Chrome, Safari…


Disclaimer: As it so often goes, I’ve found a solution to my question while I was writing the question (I’s a bit of a hack). But I’m still posting this – I would like to see your ideas… 🙂

  • 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-27T15:38:55+00:00Added an answer on May 27, 2026 at 3:38 pm

    How about this: http://jsfiddle.net/jZeVw/1/

    i.e: Just put h1 as display: inline-block;

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

Sidebar

Related Questions

I have this code and don't know if what I would like to achieve
I tried to explain how I would like to achieve this with some example
I would like to achieve this: Create a new window, which is just a
I would like to achieve this functionality. <p:column> <p:commandLink value=prihlasit oncomplete=dlg.show(); action=#{signForProjectBean.setProjectForDetail(item)} /> </p:column>
I would like to ask is there any way to achieve this functionality: I
I would like to achieve this layout : my main activity layout ( main.xml
I would like to achieve this: After first turning on the application, user receives
hi so basically i would like to achieve this: when a user clicks an
I would like to customize the presentation of faces messages. For this, <h:inputText id=name
I would like to achieve something like this one: Circular Content Carousel but I'm

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.