How to vertically center align a :before element [duplicate] - html

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>

Related

How to center an HTML element horizontally and vertically in CSS? [duplicate]

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?

Don't working vertical alignment of img in div css [duplicate]

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 {
....
}

How can i make this box align at center in css? [duplicate]

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>

Text in DIV in one horizontal line? [duplicate]

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?

Cannot align text to center [duplicate]

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)
How do I vertically center text with CSS? [duplicate]
(37 answers)
How to center an element horizontally and vertically
(27 answers)
Closed 4 years ago.
I'm trying to align text to center (vertically and horizontally):
<div class="panel-small sport">
<b>Sport and Activity</b>
</div>
this is the css:
.panel-small *
{
text-align: center;
vertical-align: middle;
}
.sport
{
background-image: url("../img/sport.png");
left: 248px;
}
the text appear even on top
Try flex positioning:
display: flex;
justify-content: center;
align-items: center;
You can check this trick:
CSS:
text-align: center;
vertical-align: middle;
line-height: 90px; /* the same as your div height */
Here is the complete explanation: https://stackoverflow.com/a/5703632/5655917
Or you can use Flexbox with this:
CSS:
.panel-small *{
display: flex;
justify-content: center;
align-items: center;
}
Here more explanation: https://tutorialzine.com/2015/09/quick-tip-the-simplest-way-to-center-elements-vertically-and-horizontally
Regards!