Adding text to a hyperlink when hovering over it

I have searched extensively to find a solution for this issue, but I simply want to include a greater-than sign in my link when it is hovered over. I prefer not to use images or tables and so on. As someone more focused on backend development, I grasp the principles behind it, just struggle to implement them.

Below is the code snippet, although I am unsure if it will be of much assistance.

<ul>
    <li><a href="#">About Us</a></li>

And here is the corresponding CSS:

li a:hover {
    font-size: 12px;
    text-transform: uppercase;
    color: #FC3;
    padding-left: 15px;
    height: 1px;
    width: 1px;
    border: thin solid #fff;
    padding-top: 10px;
    padding-right: 15px;
    padding-bottom: 10px;
}

I understand the result may not look great, and dealing with CSS like a shotgun marriage was not part of my plan for today. Any guidance on how to achieve the desired outcome would be greatly appreciated.

In essence, I aim to have it display "About Us >" upon hover.

Answer №1

An optimal cross-browser approach may be:

<a href="#">Discover More <span class="peek">&gt;</span></a>

....

li a span.peek { display: none }

li a:hover span.peek { display: block }

If you prefer the link's size to remain unchanged when hovered over, consider using visibility: hidden / visible instead of display.

Answer №2

ul li a:hover {
    font-size: 12px;
    text-transform: uppercase;
    color: #FC3;
    padding-left:15px;
    height: 1px;
    width: 1px;
    border: thin solid #fff;
    padding-top: 10px;
    padding-right: 15px;
    padding-bottom: 10px;
}
ul li a:hover:after {
    content: " &gt;";
}

This should get the job done.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Fade out a component in Material UI/React by setting a timeout in the parent's useEffect hook for when it unmounts

Incorporating a fade out transition into my child component, <Welcome />, using Material UI's Fade component is my current goal. This transition should be triggered by two specific conditions: The timeout set in the useEffect function expires. ...

What is the best way to insert a div element within another div element using dynamic

I need to cycle through the products and display them all within a div based on the data I receive in the API response. Here's the div where I want to place my product div: <div class="row" id=""> <div ...

Is it possible to use JavaScript for detecting third-party videos?

I'm currently developing an HTML5 video player that also has a fallback to flash. One of the challenges I am facing is that the video content is being provided by various third-party sources. It seems that some of these third parties serve videos bas ...

The hierarchy of styles in Rails CSS/SCSS

I'm currently exploring the concept of css precedence rules in rails. In my application, I am looking to apply different css rules based on different controllers. However, when I add css to one of the css.scss files, it ends up affecting all controll ...

Implement Icon using CSS Class in jQuery Mobile

Is there a way to use an icon in jQuery Mobile on a span element and also support retina display without giving the span a fixed width? Should I attempt to utilize Media Queries to achieve this, or is there an "official way" to do it? Thanks, Nils ...

Connect your Flask/Dash application to a customized Bootstrap stylesheet stored locally

I have created a Flask/Dash application and I am currently linking it to an external bootstrap stylesheet as shown below: dash_app = dash.Dash(server=server, routes_pathname_prefix='/dashapp/', ...

I need assistance organizing a set of cards on a webpage using Bootstrap 4. Can you help me with this task?

Looking for assistance in organizing cards on a web page using Bootstrap 4. Can anyone lend a hand? <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4I ...

What coding language corresponds to this particular hue?

Can anyone help me understand the color code 0x7FBB00FF? I'm curious about colors with 0x prefixes and wondering where I can find a tool to convert them for use in Photoshop. Any advice would be appreciated! ...

Make sure that the iframe loads the next page with enough force to break out

My dilemma involves an iframe that loads the new tab page. When a user clicks on the thumbnail, it opens within the iframe. My goal is to have any subsequent load in the iframe redirected to window.top. Is there a way to achieve this without manually setti ...

Retrieve the labels associated with highlighted text in a JTextPane

Hey everyone! I'm currently working with a JTextPane that has content type 'text/html'. I have loaded the Bible into this JTextPane where verses are separated by tags. What I want to achieve is determining the selected verse when a user clic ...

Exploring Angular 6: Unveiling the Secrets of Angular Specific Attributes

When working with a component, I have included the angular i18n attribute like so: <app-text i18n="meaning|description"> DeveloperText </app-text> I am trying to retrieve this property. I attempted using ElementRef to access nativeElement, bu ...

Can an ID and a "<?php echo ''.$variable.'' ?>" be included in the same input or video tag?

I have a task where I need to insert various Ids into a single video input tag. Specifically, I need to include the player and its row ids from PHP in this format: <video preload controls playsinline id="player[<?php echo ''.$row5['id ...

The button is only partially visible

My HTML code for a small web app has a button that says "ok," but it's too tiny to display the text fully. I wonder if I'm missing something with the span element? How can I enlarge the button so that it's bigger and shows the entire "ok" ...

Adding a div to a different webpage using jQuery

I am currently working on a small admin panel and I was curious if it is feasible to use jQuery to add a div box inside the index.php file after clicking a button in the panel? If this is possible, an example demonstrating how to do so would be greatly ap ...

The magic of CSS Pseudo-classes in Inline Styling

For the longest time, I've been under the impression that you cannot include in-line :hover{..} styles to an element. However, recently I stumbled upon this page which showcased examples like this. <a href="http://www.w3.org/" s ...

Alter elements in HTML dynamically based on the value of a cookie

I am trying to dynamically change HTML links on my website based on a cookie variable that is set by PHP. The cookie value is updated every minute through a periodic request. To ensure that the JavaScript variable remains up-to-date, I want to check it e ...

When performing web scraping with Puppeteer, employing a single selector to target various types of data

As a budding web developer, I have recently delved into coding. My current knowledge is limited to HTML, CSS, JS, and NODE. Currently, I am working on a project involving page scraping and utilizing puppeteer. CHALLENGE - In scenarios like the o ...

What is the best way to activate a click event when I set a radio button to checked?

I am facing an issue with an uninitialized property in my app.component.ts: color!:string; I am trying to automatically initialize the color property when a radio button is selected: <div> <input type="radio" name="colors" ( ...

Whenever I try to include something within the `componentWillUnmount` function,

I'm currently learning React on my own. I've been trying to save session data in my componentWillUnmount method. However, when I add code inside componentWillUnmount, nothing seems to happen. I tried debugging by adding console logs and debugger ...

Vertical alignment of divs in a single column will not be consistent

I need assistance with my website's "team" section. I am trying to ensure that the member_body divs within the same column as the member img and member header can be adjusted in width. However, they are not aligning vertically or maintaining the same ...