This question already has answers here:
How do I vertically center text with CSS? [duplicate]
(37 answers)
How to vertically align 2 different sizes of text?
(8 answers)
Align text to the bottom of a div
(2 answers)
How can I vertically align elements in a div?
(28 answers)
Vertical-align: bottom not working
(4 answers)
Closed 4 years ago.
I have such HTML+CSS code:
.top {
padding-right: 40px;
}
.w {
text-decoration: none;
font-size: 34px;
letter-spacing: 3px;
padding-left: 40px;
}
.w-right {
float: right;
letter-spacing: 4px;
}
<div class="top">
<a class="w" href="//www.site.com/">www.Site.Com</a>
<div class="w-right">sitecom corp</div>
</div>
Question: how to add indentations from above and below, so that the text was in one horizontal line?
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:
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
This question already has answers here:
Is it possible to center an inline-block element and if so, how?
(5 answers)
Flexbox: center horizontally and vertically
(14 answers)
How can I vertically align elements in a div?
(28 answers)
How can I vertically center a div element for all browsers using CSS?
(48 answers)
Closed 3 years ago.
.dkk {
color:white;
margin: 0px auto;
text-align: center;
display:inline-block;
border: 3px solid;
padding:10px;
background-color:#333333;
}
<h2 class="dkk">We are currently under construction.</h2>
This is the box. If I can know how to make this one, i can do others myself.
You should replace:
display: inline-block;
With :
display: block;
JsFiddle: https://jsfiddle.net/terza_terza/rLnz01xc/
add display:block in your css, it will work's
.dkk {
color:white;
margin: 0px auto;
text-align: center;
border: 3px solid;
padding:10px;
background-color:#333333;
display:block;
}
<h2 class="dkk">We are currently under construction.</h2>
This question already has answers here:
How can I vertically align elements in a div?
(28 answers)
Vertically align text next to an image?
(26 answers)
How do I vertically align text in a div?
(34 answers)
How to vertically align an image inside a div
(37 answers)
Vertically centering a div inside another div [duplicate]
(24 answers)
Closed 4 years ago.
How do you vertically center align a :before element. I have tried using vertical-align: bottom, vertical-align:middle, vertical-align: -50% and vertical-align:super. Nothing I do is bringing the plus symbol down to be vertically center aligned with the text next to it.
Any ideas?
.infoTitles {
color: #2E393F;
font-family: 'Muli', sans-serif;
font-size: 1.5rem;
line-height: 1.5em;
}
.infoTitles:before {
content: '';
vertical-align: super;
float: left;
margin-right: 8px;
background-image: url('https://cdn4.iconfinder.com/data/icons/ios7-essence/22/add_plus-512.png');
background-size: 15px 15px;
width: 15px;
height: 15px;
display: block;
}
<div class="faqBlock">
<div class="infoTitles">How long will I expect to wait for a quote?</div>
</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/