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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:31:22+00:00 2026-06-04T11:31:22+00:00

So I have this html: <p>here is some <span>random</span> content that I might use</p>​

  • 0

So I have this html:

<p>here is some <span>random</span> content that I might use</p>​

and this css:

span{
    position: relative;
}

span:before{
    content: 'this is more content';
    position:absolute;
    color: red;
    top: -15px;
}

What happens is, the content added with css inherits the width of the span (the word ‘random’). is there a way to remove the inherited width without adding a width value to override the inheritance

here is the demo http://jsfiddle.net/7dBbZ/1/
Thanks
​

  • 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-04T11:31:24+00:00Added an answer on June 4, 2026 at 11:31 am

    What you’re looking for is white-space:nowrap; since the element is rendered with display:inline. It doesn’t actually inherit width, as BoltClock has pointed out it is not an implicitly inherited property, but rather fills the parent element with wrapping allowed.

    http://jsfiddle.net/7dBbZ/5/

    Try playing with different values for content and see for yourself (i.e. with text shorter than the parent element, text without spaces etc.)

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

Sidebar

Related Questions

I have some HTML that looks like this: <div class=product> Content In Here <div
This is driving me nuts. Here is some HTML and CSS that I have
I have this html code that i want to edit with jQuery. Here is
I have this html: <div class=foo parent> <div class=child></div> </div> with some css: .foo{
I have, for example, markup like this <div id=content> <p>Here is some wonderful text,
I have html code that looks roughly like this: <div id=id1> <div id=id2> <p>some
I have this html code <ul> <li><a href=#><img src=path_to_image1><span>some text</span></a></li> <li><a href=#><img src=path_to_image2><span>some text</span></a></li>
quick question, I have some markdown HTML content that I'd like to convert from
I have this simple js tabs. Here is the html : <div class=product-collateral> <div
I have made this webpage, you can check it out here http://www.bettingtowin.net/webcam.html I have

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.