我能想到的最快的例子......
<h1><span>★</span>your text?</h1>
像这样的东西...
h1 {
display: inline-block;
vertical-align: middle;
font-size: 1rem;
line-height: 1.8em;
border: 1px solid red;
padding: 1em;
}
h1 span {
display: inline-block;
vertical-align: middle;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
从右到左想想:
h1:hover h1 span {
font-size: 3em;
}
“ h1 内的任何跨度,而 h1: 悬停在 -> 执行此操作...”
第2轮:这应该说明。
HTML
<ul class="icon-list">
<li>
<a href="#">
<div class="your-icon">☃</div>
Some text that doesn't move.
</a>
</li>
</ul>
CSS
.icon-list {
list-style: none;
padding: 0;
}
.icon-list li a {
display: inline-block;
height: 2em;
line-height: 2em;
text-decoration: none;
padding: 0 .5em;
color: #111;
-webkit-border-radius: 1em;
border-radius: 1em;
}
.icon-list li a:hover {
background-color: rgba(255,0,0,.1);
}
.icon-list li a .your-icon {
display: inline-block;
float: left;
width: 32px;
height: 32px;
text-align: center;
}
.icon-list li a:hover .your-icon {
font-size: 28px;
}