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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:44:09+00:00 2026-05-31T18:44:09+00:00

Is there any way to (robustly) reset any possible :after and :before CSS rules

  • 0

Is there any way to (robustly) reset any possible :after and :before CSS rules for a newly created element?

Usually you can just set the style rules you want to reset on the element directly (with !important if you want to be sure), but I don’t know of any way of changing rules defined in :after on the element only.

(Only has to work with Chrome, if at all possible.)


An example at jsFiddle.

The content added with the :before/:after rules is affecting the value returned by clientHeight.

  • 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-31T18:44:10+00:00Added an answer on May 31, 2026 at 6:44 pm

    There is a DOM2 API for that matter. The correct way to do this is

    document.getOverrideStyle(p, ':after').display = 'none'; // or
    document.getOverrideStyle(p, ':after').cssText = 'display: none !important;';
    

    Unfortunately, no browser has implemented it. (Webkit returns null, Firefox has no such method). It looks like CSS3 doesn’t even bother talking about that anymore, maybe because the usecases are very rare.

    So you’re gonna have to do some id/className magic as suggested above or in the other thread

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

Sidebar

Related Questions

Is there any way to get a predefined element with with compass(CSS Framework)? Let's
Is there any way to update a table layout after it has been created?
there any way to get my personal email accounts created in the iphone settings
Is there any way to send object / image content type created by Flotr
Is there any way to create callbacks and signals in C? I can use
Is there any way that I can export dia diagram into html (I know
Is there any way I can get NHibernate to use the READPAST hint when
Is there any way you can get CreatedBy field for SPListItem Folder . I
Is there any way i can load a silverlight application from isolated storage and
Is there any way to hover over an element that's already hidden. I am

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.