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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:31:33+00:00 2026-06-08T21:31:33+00:00

I’ve got a button ( <button> tag, but rendered like a link) inserted at

  • 0

I’ve got a button (<button> tag, but rendered like a link) inserted at the end of a line of text. I need to make a clear separation between the button and the text, so I’m using a :before pseudo element with a content: "—"; property to achieve that. So far so good.

Here is an example: http://jsfiddle.net/Anto/UPjQL/

The problem is that the content of the pseudo element behaves just like the button itself: when hovering it, the default cursor becomes a pointer cursor and the element is underlined. That makes sense, but I’d like to prevent that behavior and let it appear just like a regular text char.

Any idea ?


I know that wrapping the button inside, say, a span element and then giving the :before properties to that wrapper would be a more elegant solution, but in this case I can’t afford it.

  • 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-08T21:31:34+00:00Added an answer on June 8, 2026 at 9:31 pm

    Take a look at the fiddle http://jsfiddle.net/joplomacedo/UPjQL/3/

    .button-rendered-as-a-link {
        position: relative; <-------------
        border: none;
        padding: 0;
        margin: 0;
        background: none;
        -moz-border-radius: none;
        -webkit-border-radius: none;
        border-radius: none;
        -moz-box-shadow: none;
        -webkit-box-shadow: none;
        box-shadow: none;
        color: #8A89BA;
        font-weight: bold;
        left: 2em; <-------------
    }
    .button-rendered-as-a-link:hover {
        text-decoration: underline;
        cursor: pointer;
    }
    
    .button-rendered-as-a-link:before {
        content:" — ";
        position: absolute; <-------------
        right: 100%; <-------------
        padding: 0 5px;
        color: grey;
        cursor: default !important;
        pointer-events: none; <-------------
    }
    

    The arrows represent the stuff I’ve added.

    I’ve basically removed the pseudo element from the flow by using position: absolute. That made the button’s width equal to what it would be without the psuedo element, and therefore, it’s underline equal to no more than that width. The left and right properties put them back in place.

    Then, as to not trigger a hover on the button I set the pseudo element’s pointer-events to none. You can read more about it here https://developer.mozilla.org/en/CSS/pointer-events/.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
I need to clean up various Word 'smart' characters in user input, including but
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported

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.