I'm trying to create a simple text slider using calc()
in CSS, but it's not working.
To show how it's supposed to work, I have added the right value additionally
EDIT:
I've edited the Code and it should now contain no further errors but it still doesn't work.
The 100% in calc() seem to refer to the parent element.
Ho do i fix this ?
.box {
width: 200px;
height: 30px;
line-height: 30px;
font-family: arial;
font-weight: bold;
color: #FFF;
background: #000;
overflow: hidden;
cursor: default;
-moz-user-sselect: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
.text {
white-space: nowrap;
float: left;
padding: 0 7px;
box-sizing: border-box;
transition: margin 0.5s linear;
background: #404040;
}
.a:hover {
transition: margin 2s linear;
margin: 0 0 0 -90.25px;
}
.b:hover {
transition: margin 2s linear;
margin: 0 0 0 calc(200px - 100%);
}
<div class="box">
<div class="text a">Dieser Text ist zu groß für diese Box</div>
</div>
<br>
<div class="box">
<div class="text b">Dieser Text ist zu groß für diese Box</div>
</div>