I have a navigation block made of a list with links. I wanted all the links to be the same length with "text-align:justify" which works fine. I also wanted to add a hover effect on thos links, using CSS3 transformations and data-hover. That works too. The effect is basically making the same word translate from the bottom pushing the original word out of scope. This is done through data-hover (the data-hover specifies the content that comes into view). My problem is that I can't get to justify that content. I can change it's color, size, anything, I can even make a "text-align:right" for example, and it works, but the text-align: justify won't.
So here is the HTML:
<nav class="cl-effect-5">
<ul class="main-nav">
<li><a><span class="fulljustify" data-hover="C O L L E C T I O N">C O L L E C T I O N</span></a></li>
<li><a><span class="fulljustify" data-hover="A R T I S">A R T I S</span></a></li>
<li><a><span class="fulljustify" data-hover="S H O P">S H O P</span></a></li>
<li><a><span class="fulljustify" data-hover="A B O U T">A B O U T</span></a></li>
</ul>
</nav>
Here is the CSS:
.fulljustify { text-align: justify; text-transform: uppercase; }
.fulljustify:after { content: ""; display: inline-block; width: 100%; }
ul li{
list-style: none;
}
nav a {
position: relative;
display: inline-block;
outline: none;
text-decoration: none;
text-transform: uppercase;
font-weight: 400;
font-size: 1.35em;
width: 100%;
}
span{
width: 100%;
}
nav a:hover,
nav a:focus {
outline: none;
}
.cl-effect-5 a {
overflow: hidden;
height: 1.35em;
}
.cl-effect-5 a span {
position: relative;
display: inline-block;
-webkit-transition: -webkit-transform 0.3s;
-moz-transition: -moz-transform 0.3s;
transition: transform 0.3s;
}
.cl-effect-5 a span::before {
position: absolute;
top: 100%;
width: inherit;
color: yellow;
text-align: justify;
display: inline-block;
content: attr(data-hover);
font-weight: 700;
-webkit-transform: translate3d(0,0,0);
-moz-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
}
.cl-effect-5 a:hover span,
.cl-effect-5 a:focus span {
-webkit-transform: translateY(-100%);
-moz-transform: translateY(-100%);
transform: translateY(-100%);
}
I have created a jsfiddle so you can see more clearly what the result that I'm looking for is: http://jsfiddle.net/Lngvv5hq/
Why, if I can text-align:right the data-hover, doesn't the text-align justify work ? Any way to get it done ? If I can't do it through text-align:justify, do you happen to have any suggestions of other ways to achieve the result that I'm looking for ?
Thank you in advance