Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i make a curved text underline?

Tags:

html

css

I'm trying to use CSS and HTML to create a text underline that's curved. The curve in particular has been referred to as a "swoosh" in the design brief I was given, it needs to fall short of the first and last letter (i.e. to underline "help you", it would start at "e" and end at "o" - this part I figure is easy, applying the style to a span tag without the first and last letter), and has to have rounded ends. The swoosh is also not even.

Here's an example: enter image description here

I'm not super crash hot with CSS, but I know I'm constrained to CSS and HTML in this case - no HTML5 or using javascript to get it done.

So far, I've only managed to come up with this:

    .swoosh1 {
      width: 500px; 
      height: 100px;  
      border: solid 5px #cb1829;
      border-color: #cb1829 transparent transparent transparent;
      border-radius: 50%/100px 100px 0 0;
    }

Which looks like this (don't worry about the font): :( enter image description here

Does anyone have any pointers? Done it before?

like image 629
James D Avatar asked Jul 03 '18 07:07

James D


People also ask

How do you curve text around a shape?

Windows MacOS Web You can use WordArt with a Transform text effect to curve or bend text around a shape. If you want the text to circle the shape, you can also do this, but it’s a little bit more work. You can also insert WordArt multiple times to wrap text around shapes with straight edges.

How to use underline in word?

We’ll show you several ways to use underline in Word. Many people reserve underlining for web links while others find it a good way to emphasize text in a document. Along with the options for underlining words and spaces, you can format it as a double, bold, or dotted line and remove an underline you’ve added. Let’s walk through it all!

How do I insert curved words in Microsoft Word?

Curving Words in Word. Select the Insert tab, located towards the upper left-hand corner of the main Word interface. Select Insert WordArt, found within the Text section in Word 2016 for Windows and represented by a slanted blue letter A. In Word for macOS, as well as in earlier Windows versions, this button also contains...

Can I add curved text to photo online for free?

Yes, you can add curved text to photo online for free! MockoFun is not just a circle logo design maker or a logo maker with curved text. Use it to add text around circle shapes like this pizza for example.


2 Answers

You can use :after pseudo-element to hold your underline:

.underlined {
  position: relative;
  margin-right: 1rem;
}
.underlined:after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 0;
  height: 7px;
  width: 100%;
  border: solid 2px #cb1829;
  border-color: #cb1829 transparent transparent transparent;
  border-radius: 50%;
}
.small {
  font-size: 60%;
}
.big {
  font-size: 200%;
}
<span class="underlined">Test</span>
<span class="underlined small">Test</span>
<span class="underlined big">Test</span>
like image 113
fen1x Avatar answered Sep 30 '22 09:09

fen1x


Use :after and then use border and radius and position it

Learn about pseudo:https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements

.text:after{
    content: "";
    position: absolute;
    height: 15px;
    width: 70px;
    left: 5px;
    top: 37px;
    border-top: 2px solid red;
    border-radius: 50%;
}
.text{
 font-family: "Comic Sans MS", cursive, sans-serif;
color:red;
}
<p class="text">Your local</p>
like image 45
לבני מלכה Avatar answered Sep 30 '22 10:09

לבני מלכה