This question already has answers here:
How can I center text (horizontally and vertically) inside a div block?
(27 answers)
How to draw a circle with text in the middle?
(19 answers)
Closed 2 years ago.
So I am trying to make a single big number like 99 display on a big circle
I've read this and used its code, but the number is not aligned in the exact middle.
here's what I have so far:
.circle {
width: 300px;
height: 300px;
margin-top: 20px;
margin-left: 20px;
border-radius: 50%;
font-size: 200px;
color: #fff;
line-height: 500px;
text-align: center;
background: #000;
}
<div class="circle" id="date">99</div>
You're setting the line height to be more than the area height.
line-height: 300px;
Demo
Related
This question already has answers here:
How can I vertically center a div element for all browsers using CSS?
(48 answers)
Flexbox: center horizontally and vertically
(14 answers)
Closed 1 year ago.
I have an HTML element inside another. How can I center it by two dimensions of a wrapper at one time using CSS?
I'm trying this code:
.wrapper {
heigth: 10rem;
width: 100%;
background-color: black;
text-align: center;
}
.element {
padding: 0.25rem 0.5rem;
color: white;
border: 1px solid white;
}
<div class="wrapper">
<div class="element">Some element</div>
</div>
But it centers the element only horizontally, not vertically.
Are there any ways to solve this problem?
This question already has answers here:
In CSS Flexbox, why are there no "justify-items" and "justify-self" properties?
(6 answers)
Want to move a particular div to right
(4 answers)
Closed 2 years ago.
As you can see in the snippet below, I have some text in the <p> element, now let's say the <p> text changes (in the front-end) to something different like 'The night is dark, cold, chilly' for example with different width, how can I get the box to be responsive? So keeping the same padding all around the text? I've right now placed it there using margin-left: 55%;
.full {
width: 500px;
height: 400px;
background-color: grey;
}
p {
text-transform: uppercase;
text-align: right;
background-color: green;
color: white;
margin-left: 55%; /* THIS HAS TO edited out? */
padding: 15px;
}
<div class="full">
<p>The woods are green</p>
</div>
This question already has answers here:
How can I center text (horizontally and vertically) inside a div block?
(27 answers)
Flexbox: center horizontally and vertically
(14 answers)
Closed 2 years ago.
In my web site I have blocks that describe site features. In this block there are div element which contains img, and I want to align the image vertically in middle of the div, but my code don't working. My html code -
<div class="col-3 feature_block">
<div><img src="{{ URL::asset('pic/services1.svg') }}"/></div>
<h4>Işiň awtomatizasiýasy</h4>
<p>Awtomatlaşdyrylan proses ullanyjynyň ulgama giren badyna başlaýar.</p>
</div>
My css code -
.feature_block div{
width: 80px;
height: 80px;
border-radius: 50%;
margin: 25px 0 25px 0;
background-color: white;
text-align: center;
line-height: 80px;
vertical-align: middle;
}
What happens in browser -
screenshot of browser
Please help, thank you
This works
.feature_block div{
display:flex;
justify-content:center;
align-items:center;
}
Your class name is col-3.
So your CSS should be like this :
.col-3 div {
....
}
This question already has answers here:
How to center text vertically with a large font-awesome icon?
(15 answers)
How to vertically align text with icon font?
(10 answers)
Closed 4 years ago.
I am trying to put a tag within a button next to the label text.
I want the two to line up, but when I do that the text seems to go down, to the bottom of the button instead of in the middle.
I tried setting the line height: and also vertical align: middle, but neither seem to work. Does anyone know the fix?
Here is what I tried:
HTML
<button class='btn'>
<span>Label</span>
<i class="material-icons right">search</i>
</button>
CSS
.btn {
background-color: black;
color: white;
text-transform: uppercase;
padding: 0 15px 0 15px;
height: 40px;
}
.btn span {
line-height: 40px;
vertical-align: middle;
padding-right: 10px;
}
.btn i {
line-height: 40px;
}
Here is a fiddle:
https://jsfiddle.net/0jy6zh75/9/
This question already has answers here:
How can I horizontally center an element?
(133 answers)
Closed 6 years ago.
The whole div remains on left, I tried withe below but no luck
.captionhome {
width: 600px;
padding: 10px;
border: 5px solid black;
margin: 50px;
font-weight: bold;
font-size: 16px;
text-align: center;
}
<div class="captionhome" style="text-align: center;">WARNING: This product contains nicotine. Nicotine is an addictive chemical.</div>
Your captionhome has a set width. Either change that to 100% or add
margin: 0 auto;