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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:55:10+00:00 2026-06-07T16:55:10+00:00

I am trying to get a certain look in pure css (no images). What

  • 0

I am trying to get a certain look in pure css (no images).

What I have is:

<h2>
    <a>TITLE</a>
</h2>

I would like for the text “title” to have a black background that is the same width as the text, but a different height.

I have tried this is various permutations: (ie. span in the link, span in the h2, h2 display inline and the span a block)

<h2 class="title section-title">
    <a href="<?php echo site_url(); ?>/artwork/illustrations" >
        Illustrations<span class="title-bg"></span>
    </a>
</h2>

If I get the width right, I can’t change the height because the span is an inline element. If I get the height right by making the span a block, I can’t change get the width to be exactly the width of the text because it is now a block level element and expands to be the entire width of the page.

Any ideas, or will I simply have to use an image?

  • 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-07T16:55:11+00:00Added an answer on June 7, 2026 at 4:55 pm

    Apply position: relative; to the <a>, and position: absolute; to the .title-bg <span>. Then set the top as appropriate, the left to 0, and the width and height as appropriate.

    Something like this: http://jsfiddle.net/minitech/3uzbV/

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

Sidebar

Related Questions

I am trying to look up cells in a certain column that have a
I have C function prototypes (certain windows api header files) that look like: int
I'm trying to get a certain data from mysql with fetchAll. I currently have
I have a few images I'm trying to normalize to a certain scale by
I am trying to get a list of product id's that do not have
I'm trying to get a certain cookie in a java client by creating a
I've been trying to get a certain Google API to work for two days
Just trying to get diff to work better for certain kinds of documents. With
I'm trying to get some data from a certain web-based api using the libcurl
I'm trying to get col1 values for certain multiple col2 values. For example: I

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.