Help needed - single letter underline (different colour underline)

Soldato
Joined
6 Jan 2006
Posts
3,402
Location
Newcastle upon Tyne
Strange request but as part of a rebrand I have an orange underline on the letter O (black text). My logo has an O underlined and as part of the new brand an unlined O appears in various places.

Looking at the website draft, does anyone know if its possible to add an underline (in orange) to a single letter in a word? For example, say I've got a title of "Frequently asked Questions", is there a way to underline the o in question? Or "How's The Dog" could you add an underline to o in dog and not the How's?

Can CSS do this or will I need to look at using images of the word/titles?

Hopefully that makes some sense.

Thanks.
 
You can do it inline easily enough - just create a span with an underline around the target letter - is that good enough or do you need something to happen automatically?
 
Can you make the underline a different colour? Eg black letter with orange underline?
 
Can you make the underline a different colour? Eg black letter with orange underline?

Yes. As above you will need to create a class and then apply it in a span. CSS details here:

 
This has nearly worked perfectly but I need the underline to be tight to the letter O and not the bottom of the lowest letter eg the lowercase q. Is there a workaround to this? I know that if you were underlining the whole word it would be at the bottom of the lowest letter but I need it tight to the O. Pic below:

Qle6wCn.png


I need it to look like this:

XDEjXFV.png
 
Didn't even know this was a thing, but this works:



Code:
<html>
<head>
    <style>
        span.o { 
            text-decoration: underline; 
            text-decoration-color: orange;
         }
    </style>
</head>
<body>
    <h2>Frequently asked Questi<span class="o">o</span>ns</h2>
</body>
</html>
 
Last edited:
Didn't even know this was a thing, but this works:



Code:
<html>
<head>
    <style>
        span.o {
            text-decoration: underline;
            text-decoration-color: orange;
         }
    </style>
</head>
<body>
    <h2>Frequently asked Questi<span class="o">o</span>ns</h2>
</body>
</html>
This is awesome thanks, its worked a treat and looks exactly like I need!
 
Back
Top Bottom