Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67497

How do I responsively center text inside of a

$
0
0

I have a <div> that contains three <div>s. In each of those <div> elements is a <p> element with text and 2 nested elements to make a radial progress bar. What I need is to put the text in the middle of the circles, and do it responsively using pure CSS. I need something like this:

Wanted result

The code has flaws, like that <p> inside of a <span> but I am fixing it in the new version with the help you guys provide.

.radius-container div {
  -webkit-box-flex: 1;
  -ms-flex: 1;
  flex: 1;
}

.radius-container div:first-child {
  margin-right: 1%;
}

.radius {
  padding-top: 11em;
  height: 30em;
  text-align: center;
  border: 1px solid #858280;
  display: block;
  border-radius: 50%;
  width: 100%;
}

.radius3 {
  position: relative;
  padding-top: 10%;
  height: 15em;
  width: 50%;
  text-align: center;
  border: 1px solid #858280;
  border-left: 0;
  border-bottom: 0;
  border-top-right-radius: 100%;
  display: block;
  margin-left: 15em;
}

.radius3 p {
  position: absolute;
  right: 50%;
  top: 65%;
}
<div class="radius-container"><div><span class="radius"><p>SERBIAN<br>100%</p></span></div><div><span class="radius"><p>ENGLISH<br>100%</p></span></div><div><span class="radius3"><p>GERMAN<br>25%</p></span></div></div>

See also this jsFiddle


Viewing all articles
Browse latest Browse all 67497

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>