Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a dot / small circle under text?

How can I make a dot under text using only CSS as shown in below picture?

Picture with dot

The picture needs to be always in middle with any length of string. Probably I need to use :before OR :after? I've tried but result was awful.

like image 859
Przemysław Zamorski Avatar asked May 29 '17 07:05

Przemysław Zamorski


People also ask

How do I make a small dot in HTML?

The Unicode and HTML Entities for Bullet Points The Unicode character for showing the dot symbol or bullet point is U+2022 . But to use this Unicode correctly, remove the U+ and replace it with ampersand ( & ), pound sign ( # ), and x . Then type the 2022 number in, and then add a semi-colon.

How do you make a span round?

First, you need to display it inline-block. This allows you to manipulate its size. Then, you need to give him the same height, same width to make it square. After that, you will make a border radius of 50% so that it becomes round.


2 Answers

A transformed pseudo element can be used to create this:

body { text-align: center; }

.text {
  display: inline-block;
  vertical-align: top;
  padding-bottom: 10px;
  position: relative;
  text-align: center;
  padding: 20px 10px;
  line-height: 24px;
  min-width: 100px;
  background: #333;
  font-size: 20px;
  color: #fff;
}

.text::before {
  transform: translateX(-50%);
  border-radius: 100%;
  position: absolute;
  background: blue;
  bottom: 10px;
  height: 8px;
  content: '';
  width: 8px;
  left: 50%;
}
<div class="text">about</div>
like image 132
Mohammad Usman Avatar answered Oct 13 '22 03:10

Mohammad Usman


.char {
    display: inline-block;
    position: relative;
}
.char::before {
    content: '.';
    display: inline-block;

    position: absolute;
    bottom: -0.5em;
    left: 0;

    text-align: center;
    width: 100%;

}

After writing this question on stack i come up with idea:) Its works excatly like I want :)

like image 34
Przemysław Zamorski Avatar answered Oct 13 '22 03:10

Przemysław Zamorski