Answer the question
In order to leave comments, you need to log in
How to make the tooltip vertically centered?
The problem is from the series "simple, but it's impossible to guess."
I have a DIV with two elements: input and tooltip (span)
<div class="profile__data-input">
<input type="text" name="fieldName" value="[email protected]">
<span class="profile__data-validator-msg">
Ошибка валидации в несколько строчек и еще по всякому
</span>
</div>
__data-validator-msg {
max-width: 250px;
min-width: 150px;
background-color: $error-bg;
padding: 10px;
font-size: 12px;
color: $error-color;
position: absolute;
top: 0;
-webkit-transition: translateY (-50%);
-moz-transition: translateY (-50%);
-ms-transition: translateY (-50%);
-o-transition: translateY (-50%);
transition: translateY (-50%);
left: 280px;
z-index: 100;
&:before {
content: "";
position: absolute;
border: 14px solid transparent;
border-right: 7px solid $error-bg;
left: -21px;
top: calc(50% - 14px);
}
}
Answer the question
In order to leave comments, you need to log in
Any of the ways on the request "CSS vertical alignment"
for example,
top: 50%;
transform: translateY(-50%);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question