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

The Archive Base Latest Questions

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

It would be cool if there was such an option, else I’d have to

  • 0

arrow

It would be cool if there was such an option, else I’d have to overlap the border-bottom with another div..

  • 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-17T07:11:42+00:00Added an answer on June 17, 2026 at 7:11 am

    EDIT: What I’d do these days if there’s a bit more in terms of the element’s text content is use box-shadow and background-clip. Otherwise, see the last solution in my original answer.

    div {
      border-bottom: solid .75em transparent;
      margin: 7em auto 1em;
      width: 10em; height: 5em;
      box-shadow: 0 1px 0 -1px black;
      background: dimgrey padding-box;
    }
    <div></div>

    Let’s dissect the above.

    First off, border-bottom: solid .75em transparent.

    The border-bottom area is going to be the gap area. That’s why we make it transparent. Changing the width of this border changes the width of the gap.

    The margin, width and height rules – nothing strange here, just positioning and sizing the element.

    Then we have this bit: box-shadow: 0 1px 0 -1px black.

    This box-shadow with no blur creates the bottom border. The y offset (second value) creates a 1px "border". Increasing this y offset increases the width of our "border". This is a black border, but we could change that to anything else.

    We also don’t want our box-shadow to show up on the sides, so we give it a -1px spread.

    Finally, we set a background on our element. It’s a dimgrey one, but it could be anything else (a gradient, a picture, whatever). By default backgrounds extend under the border as well, but we don’t want that, so we limit it to the area of the padding-box. I’ve used the shorthand here. The longhand property is background-clip and you can find a detailed explanation for how it works and other examples similar to this one in this article (disclaimer: I wrote it).


    Here is the original answer

    You could use a pseudo element. Absolutely positioned, 100% width, offset below the bottom of the element.

    demo

    HTML:

    <div></div>
    

    CSS:

    div {
        position: relative;
        margin: 7em auto 1em;
        width: 10em; height: 5em;
        background: dimgrey;
    }
    div:after {
        position: absolute;
        bottom: -.8em;
        width: 100%;
        border-bottom: solid 1px;
        content: '';
    }
    

    Or you could use background-clip: content-box and you won’t need to use a pseudo-element. But then your text will stick to the edges of the background (unless it’s a small text and centred).

    demo

    Relevant CSS:

    div {
        margin: 7em auto 1em;
        padding: 0 0 .8em;
        border-bottom: solid 1px;
        width: 10em; height: 5em;
        background: dimgrey content-box;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have no idea if this is possible ... but it would be cool.
I thought it would be a cool experiment to have a for loop and
I cant see who would make such a decision but is there any such
I thought it would be cool to turn the hardware button lights on when
To learn more about Eclipse plugin development, it would be cool if I could
Someone once showed me a cool IntelliJ Idea plugin that would show all the
Would be possible to extend this kind of layout so that I can have
A VERY nice to have would be if I could edit object-literals in this
Does anyone know any cool text editing program for easy code translation? I have
I have a <div id=refresh> that has some MySQL content in it. I has

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.