Make a circular border around the text


tracer

Now, I want to put a plus sign around it.

http://jsfiddle.net/dtracers/cvtztcy1/1/

<h1>TEXY TXT <span>+</span></h1>

<style>
span {
    border-radius: 50%;
    border-style:solid;
    border-width: 1px 3px 1px 1px;
    padding:0px;
    padding-bottom:0.125em;
    cursor:pointer;
    margin:0px;
}

/* Just to see if that would modify anything */
h1 {
    padding:0px;
    margin:0px;
}
</style>

After looking at it, you can see that this is not a circle, but an ellipse. I've realized that the text height is causing the problem, but there is a way to make it look closer.

The background is dynamic so I can't use images. Also, I'd rather not have floating elements that rely on absolute positioning.

I also want the height of the circle to be equal to its current width. I know I can make it bigger, but I don't want a big circle, I want a tight little circle

EDIT For those who said it was the same problem, kinda. The difference between what I'm asking and what the guy asked is that in this case the circle is larger than the border of the text.

What I want is a circle that is smaller than the border of the text. So none of the solutions given here worked for my problem.

Kheema Pandey

You can use :afterpseudo-elements to achieve this . Check the demo .

span {
  position:relative;
  padding:0; margin:0;
  cursor: pointer;
}
span:after
{
content:"";
position:absolute;
display:inline-block;
left:-1px;
top:7px;
background:gold;
border-radius: 50%;
width:0.5em;
height:0.5em;
font-size:1.3em;
z-index:-1;
}

Related


How to make a circular border around social icons?

Nick Allaire .icon { padding: 5px 10px; display: inline-block; -moz-border-radius: 100px; -webkit-border-radius: 100px; border-radius: 100px; -moz-box-shadow: 0px 0px 2px #888; -webkit-box-shadow: 0px

How to make a circular border around social icons?

Nick Allaire .icon { padding: 5px 10px; display: inline-block; -moz-border-radius: 100px; -webkit-border-radius: 100px; border-radius: 100px; -moz-box-shadow: 0px 0px 2px #888; -webkit-box-shadow: 0px

Make a round border, behind the text - not around

Achar I'll try to take what I've seen before and recreate it in html/css. Here is a mockup I made in Word. Almost everything I found was about the text inside the circle , not the accent behind it, like this picture. I want the circle and text to be as centere

Remove border around circular image

John Du I have a circular image (.png file) with transparency in the middle. I need to make the background inside the image a solid color. For this I make the background solid and put in border-radius:50%, but this produces ugly little white lines. Is there an

Darker border around circular CALayer

Oliver Cooper I'm creating a custom view to display a color, it's for a color picker in an image, so the color may change quickly. To prevent the color from flickering as the cursor moves, I made it to animate the color change in 0.2 seconds. I am using CALaye

Partial circular border around element

original I am trying to achieve this without an image (yellow): The most detailed border generator I've found is this generator available in MDN . But it doesn't work. Is there any other way? Harry Yes, it can be achieved by a combination of the inset in the l

Remove border around circular image

John Du I have a circular image (.png file) with transparency in the middle. I need to make the background inside the image a solid color. For this I make the background solid and put in border-radius:50%, but this produces ugly little white lines. Is there an

Remove border around circular image

John Du I have a circular image (.png file) with transparency in the middle. I need to make the background inside the image a solid color. For this I make the background solid and put in border-radius:50%, but this produces ugly little white lines. Is there an

Darker border around circular CALayer

Oliver Cooper I'm creating a custom view to display a color, it's for a color picker in an image, so the color may change quickly. To prevent the color from flickering as the cursor moves, I made it to animate the color change in 0.2 seconds. I am using CALaye

Partial circular border around element

original I am trying to achieve this without an image (yellow): The most detailed border generator I've found is this generator available in MDN . But it doesn't work. Is there any other way? Harry Yes, it can be achieved by a combination of the inset in the l

Partial circular border around element

Prims I am trying to achieve this without an image (yellow): The most detailed border-generator I've found is this generator available in MDN . However, it doesn't work. Is there any other way? Harry Yes, this can be achieved box-shadowwith a combination of th

Remove border around circular image

John Du I have a circular image (.png file) with transparency in the middle. I need to make the background inside the image a solid color. For this I make the background solid and put in border-radius:50%, but this produces ugly little white lines. Is there an

Remove border around circular image

John Du I have a circular image (.png file) with transparency in the middle. I need to make the background inside the image a solid color. For this I make the background solid and put in border-radius:50%, but this produces ugly little white lines. Is there an

Remove border around circular image

John Du I have a circular image (.png file) with transparency in the middle. I need to make the background inside the image a solid color. For this I make the background solid and put in border-radius:50%, but this produces ugly little white lines. Is there an

Remove border around circular image

John Du I have a circular image (.png file) with transparency in the middle. I need to make the background inside the image a solid color. For this I make the background solid and put in border-radius:50%, but this produces ugly little white lines. Is there an

Partial circular border around element

Prims I am trying to achieve this without an image (yellow): The most detailed border-generator I've found is this generator available in MDN . However, it doesn't work. Is there any other way? Harry Yes, this can be achieved box-shadowwith a combination of th

Add text in a circular border

eternal The code below adds a radio button with a number inside the border, but the border should be round, how can I make it round? Note that the position of the text is important and not affected by css. p { outline-style: solid; padding : 16px; po

Circle text around circular text

xdtTransform content: Try putting the SVG path text on top of the circular image. Use to round a square image rounded-circle. SVG paths are drawn around it and used to write text. Lead to: Code : https://jsfiddle.net/ghLn4jkt/ _ <div class="mt-3 row"> <div

Circle text around circular text

xdtTransform content: Try putting the SVG path text on top of the circular image. Use to round a square image rounded-circle. SVG paths are drawn around it and used to write text. lead to: Code : https://jsfiddle.net/ghLn4jkt/ _ <div class="mt-3 row"> <div

Flutter:- Create a circular border around the icon

Atul Chaudhary I want to create a circular border around the icon as shown. Container( margin: EdgeInsets.all(20), padding: EdgeInsets.all(10), decoration: BoxDecoration( borderRadius: BorderRadius.circ

How to put a multicolor border around a circular image?

Sykes I need to put a colored border around a circular image. Border example I've tried various guides online but can't seem to get the hang of it. I tried using a linear gradient, but I ended up with 4 points at the corners, as if the image were square with n

Flutter:- Create a circular border around the icon

Atul Chaudhary I want to create a circular border around the icon as shown. Container( margin: EdgeInsets.all(20), padding: EdgeInsets.all(10), decoration: BoxDecoration( borderRadius: BorderRadius.circ

How to draw a border around a circular ImageView in Android?

Filip Luchianenco What I achieved is to convert the given image from a square to a circle, but now I can't get the border, just a simple white border around it. public class RoundedImageView extends ImageView { public RoundedImageView(Context context) { s

Correct circular border around field and legend

Zeth I'm trying to find a border around a fieldset and its legend without including the bottom of that border on the legend. This is the default behavior: fieldset { border: 1px solid #ccc; border-radius: 5px; padding: 25px; } legend { border: 1px so

Flutter:- Create a circular border around the icon

Atul Chaudhary I want to create a circular border around the icon as shown. Container( margin: EdgeInsets.all(20), padding: EdgeInsets.all(10), decoration: BoxDecoration( borderRadius: BorderRadius.circ

Flutter:- Create a circular border around the icon

Atul Chaudhary I want to create a circular border around the icon as shown. Container( margin: EdgeInsets.all(20), padding: EdgeInsets.all(10), decoration: BoxDecoration( borderRadius: BorderRadius.circ

Flutter:- Create a circular border around the icon

Atul Chaudhary I want to create a circular border around the icon as shown. Container( margin: EdgeInsets.all(20), padding: EdgeInsets.all(10), decoration: BoxDecoration( borderRadius: BorderRadius.circ

Correct circular border around field and legend

Zeth I'm trying to find a border around a fieldset and its legend without including the bottom of that border on the legend. This is the default behavior: fieldset { border: 1px solid #ccc; border-radius: 5px; padding: 25px; } legend { border: 1px so

Correct circular border around field and legend

Zeth I'm trying to find a border around a fieldset and its legend without including the bottom of that border on the legend. This is the default behavior: fieldset { border: 1px solid #ccc; border-radius: 5px; padding: 25px; } legend { border: 1px so