I am a graphic designer and new to coding.
Can someone let me know how do I put a number inside a circle in pure HTML? I am putting it inside a table.
I am a graphic designer and new to coding.
Can someone let me know how do I put a number inside a circle in pure HTML? I am putting it inside a table.
First, create your Circle in CSS..
#circle {
width: 100px;
height: 100px;
background-image: linear-gradient(to right, rgb(38, 165, 166) 0%, rgb(124, 26, 94) 100%);
border-radius: 50%
}
This will be shown in a HTML container with id circle
..
<div id="circle"></div>
Inside this DIV you can put whatever number you like..
<div id="circle">69</div>
It might not align properly, so you cann modify the CSS to play.
text-align: center;
Good luck with your learning, but you should show some effort when asking a question too.
EDIT//
For your pure HTML version.. You can just add the CSS to inline..
<div style="width: 100px;
height: 100px;
background-image: linear-gradient(to right, rgb(38, 165, 166) 0%, rgb(124, 26, 94) 100%);
border-radius: 50%;
text-align: center;"><h1>
69
</h1>
</div>
Using CSS background-radius
property set to 50%
.
An example:
.encircled {
display: inline-block;
padding: 1em;
text-align: center;
width: 20px;
height: 20px;
border-radius: 50%;
background: orange;
border: 5px solid black;
}
<div class="encircled">42</div>
You need to use HTML
with CSS
.
Below is the CSS Code:
.circle{
border: 1px solid black;
border-radius: 50%;
height: 50px;
width: 50px;
text-align: center;
justify-content: center;
position: relative;
}
HTML code should be:
<div class="circle">
<p>1</p>
</div>
.circle{
border: 1px solid black;
border-radius: 50%;
height: 50px;
width: 50px;
text-align: center;
justify-content: center;
position: relative;
}
<div class="circle">
<p>1</p>
</div>
Actually Table in HTML can be inflexible so there many ways you can write your code to suit your needs, but this is an idea behind it. HTML
<ul>
<li><span>1</span>First Element</li>
<li><span>2</span>Second Element</li>
</ul>
CSS
li>span {
display: inline-block;
padding: 5px;
border: 2px solid black; /* black border */
border-radius: 50%; /* for round enclosing border */
}
This should work and editable. Comment for further notice.