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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:22:55+00:00 2026-05-24T21:22:55+00:00

I have a design I want to implement that involves title text appearing with

  • 0

I have a design I want to implement that involves title text appearing with its own background color, padded by 10px, over an image, par example:

https://i.stack.imgur.com/E7EpS.png

The first example in this picture works well, and is simple:

.greenbox {width:520px; height:261px; position:relative;}
.greenbox span { padding:0 10px; background:#000; position:absolute; left:0; bottom:40px; }

Trouble arises when the text overflows onto another line, then the span elements padding does not effect the text on the line breaks, it renders like so:

https://i.stack.imgur.com/pY18f.png

Anyone know of an alternative, or how they would set this design out so that the background color & padding was consistent?

Thanks in advance

Edit: I had simplified the code to make it concise, but had missed a vital part. Actually it’s like this:

.greenbox {width:520px; height:261px; position:relative;}
.greenbox a {position:absolute; left:0; bottom:40px; }
.greenbox span { padding:0 10px; background:#000; }

With the html as:

<div class="greenbox">

    <a href="link"><span>The Title Goes Here</span></a>

</div>

Thus the span remains inline, wrapped in a absolute position anchor.

  • 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-24T21:22:55+00:00Added an answer on May 24, 2026 at 9:22 pm

    I’ve tackled something similar before: Add padding at the beginning and end of each line of text

    I’ve robbed that solution from myself, and fit it to your case.

    Note that the line-height and padding adjustments can be very tricky to get right.

    See: http://jsbin.com/ahoyug

    HTML:

    <div class="greenbox">
        <a href="#"><span><span>
            The Title Goes Here, with overflow
        </span></span></a>
    </div>
    

    CSS:

    .greenbox {width:500px; height:200px; position:relative; background:green}
    
    .greenbox > a {
        font: 50px sans-serif;
        line-height: 1.14;
        padding: 0;
        border-left: 20px solid #000;
        position: absolute;
        left: 0;
        bottom: 60px;
        text-decoration: none;
        color: #fff
    }
    .greenbox > a > span {
        background: #000
    }
    .greenbox > a > span > span {
        position: relative;
        left: -10px
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to implement singleten design pattern in iphone code I have one array.
I want to implement an aplication where I have various Objects that can be
I Have a problem that, I want design a Scroller which contains a dynamic
I have a design for a GC algorithm that I would like to implement
I have a quite specific client-server design case and I want to ask for
I want to change my window design rapidly. I have OnPaint function which I
I have a lot of customized javascript and layout design, and I want to
I have a design issue that I would appreciate some input on. I would
I have started design of a ColdFusion application that is entirely web based. Not
I have to design a data structure that is to be used in a

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.