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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:54:17+00:00 2026-05-25T16:54:17+00:00

Please see http://jsfiddle.net/ZWw3Z/ <p>Text text text text text text text…</p> p { background-color: blue;

  • 0

Please see http://jsfiddle.net/ZWw3Z/

<p>Text text text text text text text...</p>
p {
    background-color: blue;
}

p:before {
    content: '';
    position: absolute;
    width: 10px;
    height: 100%;
    background-color: red;
}

Essentially, the height of the pseudo element is too big. I want it to have the same height as the p element. How can I do that?

  • 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-25T16:54:18+00:00Added an answer on May 25, 2026 at 4:54 pm

    To future readers, the effect was to have a bar appear over text on the left-hand side. To accomplish this, the OP was using position: absolute; on the psuedo element (p:before).

    The error OP was encountering was because the psuedo-element was treating the <body> as it’s relative position point – to fix, simply set position: relative; on the <p> tag.

    p {
      position: relative;
      background-color: blue;
      padding-left: 10px;
      /* change the padding to something larger 
      than the width of the :before element to 
      add spacing for text
      */
    }
    
    p:before {
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      width: 10px;
      height: 100%;
      background-color: red;
    }
    <p>text... text...</p>
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please see this fiddle: http://jsfiddle.net/ZWw3Z/5/ My code is: p { position: relative; background-color: blue;
Please see my source code at: http://jsfiddle.net/rAmSG/9/ The blue item should be dropped at
please see the following: http://jsfiddle.net/8sq2w/ Problem: Focus in the item Highlight the text and
the .click() event doesn't seem to work on select, please see: http://jsfiddle.net/fMTzD/ Even before
Please see this: http://jsfiddle.net/uNbYu/1/ If you click submit, the button doesn't do anything, but
please see this example http://jsfiddle.net/7trcV/ what I'm trying to achieve is ability to put
Please see the solution to another question provided by ud3323: http://jsfiddle.net/ud3323/ykL69/ . This solution
Please see http://jsfiddle.net/jaWjB/1/ The line break happens in between the second image and its
please see my fiddle: http://jsfiddle.net/qVHg8/1/ Why isn't the fixedRightCol being positioned at right:0 of
Please see my jsfiddle i've created to replicate my problem. http://jsfiddle.net/motocomdigital/22KFS/3/ In my project,

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.