我对CSS的一个小问题有点困惑: 我有一个带有过渡的按钮,在此过渡过程中我的箭头会移动,但是,它下面的阴影框不会随之移动。
我有什么想法/建议可以解决这个问题吗?
<div class="download_btn download_button">
<a class="btn left">
<span class="left icon icon-lock"></span>
<span class="right title"><span class="arrow-right"></span>Click here</span>
</a>
</div>
答案 0 :(得分:2)
作为一种快速解决方案,您可以采用此变体
<a class="btn left">
<span class="left icon icon-lock">
<span class="arrow-right"></span>
</span>
<span class="right title">Click here</span>
</a>
此外,CSS有点更新。
.landing_page .step_container .download_container .download_btn .btn.left span.arrow-right {
left: 100%;
top: 0;
z-index: 1;
}
.landing_page .step_container .download_container .download_btn .btn.left span.arrow-right:before {
right: 10px;
top: 25px;
height: 5px;
width: 7px;
background: #030e15;
content: '';
position: absolute;
}
.landing_page .step_container .download_container .download_btn .btn:hover span.arrow-right {
left: calc(100% + 5px);
}
答案 1 :(得分:0)
@font-face {
font-family: 'play-regular';
src: url('../fonts/play-regular.eot');
src: url('../fonts/play-regular.eot') format('embedded-opentype'), url('../fonts/play-regular.woff') format('woff'), url('../fonts/play-regular.ttf') format('truetype'), url('../fonts/play-regular.svg') format('svg');
font-weight: normal;
font-style: normal;
}
html {
background: url(../img/gradient.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-color: #1D577C;
}
body {
font-weight: normal;
margin: 0;
font-size: 12px;
width: 100%;
font-family: 'play-regular';
background-color: transparent;
}
/* Variables */
* {
margin: 0;
padding: 0;
}
*:before,
*:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: normal;
line-height: 1;
}
.wrapper {
width: 960px;
margin: 0 auto;
}
@media (max-width: 995px) {
.wrapper {
width: 98%;
}
}
.page_wrapper {
width: 1400px;
margin: 0 auto;
}
@media (max-width: 1420px) {
.page_wrapper {
width: 98%;
}
}
.clearfix:before,
.clearfix:after {
content: " ";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
zoom: 1;
}
ul,
li {
list-style: none;
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 0px;
}
a {
text-decoration: none;
}
img {
max-width: 100%;
height: auto;
}
.align_center {
text-align: center;
}
.align_left {
text-align: left;
}
.align_right {
text-align: right;
}
.float_left {
float: left;
}
.float_right {
float: right;
}
@font-face {
font-family: 'icomoon';
src: url('../fonts/icomoon.eot?-1vhccs');
src: url('../fonts/icomoon.eot?#iefix-1vhccs') format('embedded-opentype'), url('../fonts/icomoon.woff?-1vhccs') format('woff'), url('../fonts/icomoon.ttf?-1vhccs') format('truetype'), url('../fonts/icomoon.svg?-1vhccs#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
[class^="icon-"],
[class*=" icon-"] {
font-family: 'icomoon';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-lock:before {
content: "\e606";
}
.icon-help:before {
content: "\e604";
}
.icon-unlocked2:before {
content: "\e602";
}
.icon-file-add:before {
content: "\e603";
}
.icon-arrow-down3:before {
content: "\e60a";
}
.icon-question:before {
content: "\f128";
}
.icon-download:before {
content: "\e600";
}
.icon-hand:before {
content: "\f0a4";
}
.icon-unlocked:before {
content: "\e601";
}
.icon-comment:before {
content: "\e605";
}
.icon-file-text2:before {
content: "\e926";
}
.icon-folder-open:before {
content: "\e930";
}
.icon-unlocked3:before {
content: "\e990";
}
.icon-download2:before {
content: "\e9c2";
}
.icon-arrow-down:before {
content: "\ea36";
}
.icon-arrow-down2:before {
content: "\ea3e";
}
.icon-point-right:before {
content: "\ea04";
}
/* ========================================= grid css =============================================== */
.content {
padding: 10px;
}
.row {
zoom: 1;
letter-spacing: normal;
word-spacing: normal;
vertical-align: top;
text-rendering: auto;
margin-bottom: 0px;
}
.row > [class*="col_"] {
min-height: 1px;
}
[class*="col_xs_"] {
float: left;
}
.col_xs_1 {
width: 100%;
}
.col_xs_1_2 {
width: 50%;
*width: 49.969%;
}
.col_xs_1_3 {
width: 33.3333%;
*width: 33.3023%;
}
.col_xs_2_3 {
width: 66.6667%;
*width: 66.6357%;
}
.col_xs_1_4 {
width: 25%;
*width: 24.969%;
}
.col_xs_3_4 {
width: 75%;
*width: 74.969%;
}
.col_xs_1_5 {
width: 20%;
*width: 19.969%;
}
.col_xs_2_5 {
width: 40%;
*width: 39.969%;
}
.col_xs_3_5 {
width: 60%;
*width: 59.969%;
}
.col_xs_4_5 {
width: 80%;
*width: 79.969%;
}
.col_xs_1_6 {
width: 16.6667%;
*width: 16.6357%;
}
.col_xs_5_6 {
width: 83.3333%;
*width: 83.3023%;
}
.col_xs_1_8 {
width: 12.5%;
*width: 12.469%;
}
.col_xs_3_8 {
width: 37.5%;
*width: 37.469%;
}
.col_xs_5_8 {
width: 62.5%;
*width: 62.469%;
}
.col_xs_7_8 {
width: 87.5%;
*width: 87.469%;
}
.col_xs_1_12 {
width: 8.3333%;
*width: 8.3023%;
}
.col_xs_5_12 {
width: 41.6667%;
*width: 41.6357%;
}
.col_xs_7_12 {
width: 58.3333%;
*width: 58.3023%;
}
.col_xs_11_12 {
width: 91.6667%;
*width: 91.6357%;
}
.col_xs_1_24 {
width: 4.1667%;
*width: 4.1357%;
}
.col_xs_5_24 {
width: 20.8333%;
*width: 20.8023%;
}
.col_xs_7_24 {
width: 29.1667%;
*width: 29.1357%;
}
.col_xs_11_24 {
width: 45.8333%;
*width: 45.8023%;
}
.col_xs_13_24 {
width: 54.1667%;
*width: 54.1357%;
}
.col_xs_17_24 {
width: 70.8333%;
*width: 70.8023%;
}
.col_xs_19_24 {
width: 79.1667%;
*width: 79.1357%;
}
.col_xs_22_24 {
width: 91.6667%;
*width: 91.6367%;
}
.col_xs_23_24 {
width: 95.8333%;
*width: 95.8023%;
}
@media (min-device-width: 769px) and (min-width: 769px) {
[class*="col_sm_"] {
float: left;
}
.col_sm_1 {
width: 100%;
}
.col_sm_1_2 {
width: 50%;
*width: 49.969%;
}
.col_sm_1_3 {
width: 33.3333%;
*width: 33.3023%;
}
.col_sm_2_3 {
width: 66.6667%;
*width: 66.6357%;
}
.col_sm_1_4 {
width: 25%;
*width: 24.969%;
}
.col_sm_3_4 {
width: 75%;
*width: 74.969%;
}
.col_sm_1_5 {
width: 20%;
*width: 19.969%;
}
.col_sm_2_5 {
width: 40%;
*width: 39.969%;
}
.col_sm_3_5 {
width: 60%;
*width: 59.969%;
}
.col_sm_4_5 {
width: 80%;
*width: 79.969%;
}
.col_sm_1_6 {
width: 16.6667%;
*width: 16.6357%;
}
.col_sm_5_6 {
width: 83.3333%;
*width: 83.3023%;
}
.col_sm_1_8 {
width: 12.5%;
*width: 12.469%;
}
.col_sm_3_8 {
width: 37.5%;
*width: 37.469%;
}
.col_sm_5_8 {
width: 62.5%;
*width: 62.469%;
}
.col_sm_7_8 {
width: 87.5%;
*width: 87.469%;
}
.col_sm_1_12 {
width: 8.3333%;
*width: 8.3023%;
}
.col_sm_5_12 {
width: 41.6667%;
*width: 41.6357%;
}
.col_sm_7_12 {
width: 58.3333%;
*width: 58.3023%;
}
.col_sm_11_12 {
width: 91.6667%;
*width: 91.6357%;
}
.col_sm_1_24 {
width: 4.1667%;
*width: 4.1357%;
}
.col_sm_5_24 {
width: 20.8333%;
*width: 20.8023%;
}
.col_sm_7_24 {
width: 29.1667%;
*width: 29.1357%;
}
.col_sm_11_24 {
width: 45.8333%;
*width: 45.8023%;
}
.col_sm_13_24 {
width: 54.1667%;
*width: 54.1357%;
}
.col_sm_17_24 {
width: 70.8333%;
*width: 70.8023%;
}
.col_sm_19_24 {
width: 79.1667%;
*width: 79.1357%;
}
.col_sm_22_24 {
width: 91.6667%;
*width: 91.6367%;
}
.col_sm_23_24 {
width: 95.8333%;
*width: 95.8023%;
}
}
@media (min-device-width: 992px) and (min-width: 992px) {
[class*="col_md_"] {
float: left;
}
.col_md_1 {
width: 100%;
}
.col_md_1_2 {
width: 50%;
*width: 49.969%;
}
.col_md_1_3 {
width: 33.3333%;
*width: 33.3023%;
}
.col_md_2_3 {
width: 66.6667%;
*width: 66.6357%;
}
.col_md_1_4 {
width: 25%;
*width: 24.969%;
}
.col_md_3_4 {
width: 75%;
*width: 74.969%;
}
.col_md_1_5 {
width: 20%;
*width: 19.969%;
}
.col_md_2_5 {
width: 40%;
*width: 39.969%;
}
.col_md_3_5 {
width: 60%;
*width: 59.969%;
}
.col_md_4_5 {
width: 80%;
*width: 79.969%;
}
.col_md_1_6 {
width: 16.6667%;
*width: 16.6357%;
}
.col_md_5_6 {
width: 83.3333%;
*width: 83.3023%;
}
.col_md_1_8 {
width: 12.5%;
*width: 12.469%;
}
.col_md_3_8 {
width: 37.5%;
*width: 37.469%;
}
.col_md_5_8 {
width: 62.5%;
*width: 62.469%;
}
.col_md_7_8 {
width: 87.5%;
*width: 87.469%;
}
.col_md_1_12 {
width: 8.3333%;
*width: 8.3023%;
}
.col_md_5_12 {
width: 41.6667%;
*width: 41.6357%;
}
.col_md_7_12 {
width: 58.3333%;
*width: 58.3023%;
}
.col_md_11_12 {
width: 91.6667%;
*width: 91.6357%;
}
.col_md_1_24 {
width: 4.1667%;
*width: 4.1357%;
}
.col_md_5_24 {
width: 20.8333%;
*width: 20.8023%;
}
.col_md_7_24 {
width: 29.1667%;
*width: 29.1357%;
}
.col_md_11_24 {
width: 45.8333%;
*width: 45.8023%;
}
.col_md_13_24 {
width: 54.1667%;
*width: 54.1357%;
}
.col_md_17_24 {
width: 70.8333%;
*width: 70.8023%;
}
.col_md_19_24 {
width: 79.1667%;
*width: 79.1357%;
}
.col_md_22_24 {
width: 91.6667%;
*width: 91.6367%;
}
.col_md_23_24 {
width: 95.8333%;
*width: 95.8023%;
}
}
@media (min-width: 1200px) {
[class*="col_lg_"] {
float: left;
}
.col_lg_1 {
width: 100%;
}
.col_lg_1_2 {
width: 50%;
*width: 49.969%;
}
.col_lg_1_3 {
width: 33.3333%;
*width: 33.3023%;
}
.col_lg_2_3 {
width: 66.6667%;
*width: 66.6357%;
}
.col_lg_1_4 {
width: 25%;
*width: 24.969%;
}
.col_lg_3_4 {
width: 75%;
*width: 74.969%;
}
.col_lg_1_5 {
width: 20%;
*width: 19.969%;
}
.col_lg_2_5 {
width: 40%;
*width: 39.969%;
}
.col_lg_3_5 {
width: 60%;
*width: 59.969%;
}
.col_lg_4_5 {
width: 80%;
*width: 79.969%;
}
.col_lg_1_6 {
width: 16.6667%;
*width: 16.6357%;
}
.col_lg_5_6 {
width: 83.3333%;
*width: 83.3023%;
}
.col_lg_1_8 {
width: 12.5%;
*width: 12.469%;
}
.col_lg_3_8 {
width: 37.5%;
*width: 37.469%;
}
.col_lg_5_8 {
width: 62.5%;
*width: 62.469%;
}
.col_lg_7_8 {
width: 87.5%;
*width: 87.469%;
}
.col_lg_1_12 {
width: 8.3333%;
*width: 8.3023%;
}
.col_lg_5_12 {
width: 41.6667%;
*width: 41.6357%;
}
.col_lg_7_12 {
width: 58.3333%;
*width: 58.3023%;
}
.col_lg_11_12 {
width: 91.6667%;
*width: 91.6357%;
}
.col_lg_1_24 {
width: 4.1667%;
*width: 4.1357%;
}
.col_lg_5_24 {
width: 20.8333%;
*width: 20.8023%;
}
.col_lg_7_24 {
width: 29.1667%;
*width: 29.1357%;
}
.col_lg_11_24 {
width: 45.8333%;
*width: 45.8023%;
}
.col_lg_13_24 {
width: 54.1667%;
*width: 54.1357%;
}
.col_lg_17_24 {
width: 70.8333%;
*width: 70.8023%;
}
.col_lg_19_24 {
width: 79.1667%;
*width: 79.1357%;
}
.col_lg_22_24 {
width: 91.6667%;
*width: 91.6367%;
}
.col_lg_23_24 {
width: 95.8333%;
*width: 95.8023%;
}
}
/* =============================== PAGE STYLES ================================ */
.landing_page {
display: block;
}
.landing_page .header_title {
background: url('../img/gradient-menu.png') center;
height: 45px;
}
.landing_page .header_title p {
color: #ffffff;
line-height: 45px;
font-size: 20px;
text-shadow: 0px 4px 3px rgba(0, 0, 0, 0.4), 0px 8px 13px rgba(0, 0, 0, 0.1), 0px 18px 23px rgba(0, 0, 0, 0.1);
font-weight: 700;
}
.landing_page .step_container {
min-height: 100%;
}
.landing_page .step_container h4.heading {
text-transform: uppercase;
font-size: 25px;
color: #141b29;
margin-top: 20px;
margin-left: 15px;
}
.landing_page .step_container h4.heading i,
.landing_page .step_container h4.heading span {
vertical-align: middle;
}
.landing_page .step_container h4.heading span {
margin-left: 10px;
}
.landing_page .step_container .download_container .text_part {
text-align: center;
margin-top: 40px;
color: #ffffff;
font-size: 25px;
line-height: 30px;
text-transform: uppercase;
}
.landing_page .step_container .download_container .down {
text-align: center;
margin-top: 40px;
height: 50px;
}
.landing_page .step_container .download_container .down span {
background: #0e3a57;
border: 1px solid #dddddd;
width: 20px;
height: 40px;
position: relative;
padding: 0 10px;
top: -10px;
display: inline-block;
}
.landing_page .step_container .download_container .down span i {
font-size: 20px;
color: #ffffff;
position: relative;
top: 20px;
display: block;
}
.landing_page .step_container .download_container .download_file {
width: 478px;
margin: 0px auto;
}
.landing_page .step_container .download_container .download_file .icon_container {
float: left;
margin: 34px;
}
.landing_page .step_container .download_container .download_file .download_text {
float: right;
width: 280px;
margin-top: 42px;
color: #ffffff;
}
.landing_page .step_container .download_container .download_file .download_text p {
font-size: 18px;
}
.landing_page .step_container .download_container .download_file .download_text h4 {
font-size: 30px;
margin: 20px auto;
}
.landing_page .step_container .download_container .download_btn {
text-align: center;
margin: 10px auto;
}
.landing_page .step_container .download_container .download_btn .btn {
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
position: relative;
display: inline-block;
overflow: hidden;
height: 53px;
border-radius: 6px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
line-height: 30px;
font-size: 16px;
font-weight: bold;
text-shadow: 0px 1px 1px #888;
text-decoration: none;
color: #ffffff;
margin: 0 10px;
}
.landing_page .step_container .download_container .download_btn .btn span.icon {
font-size: 23px;
background-color: #071d2b;
-webkit-box-shadow: 0px 3px 0px 0px #030e15;
box-shadow: 0px 3px 0px 0px #030e15;
text-shadow: 0px 1px 1px #888;
}
.landing_page .step_container .download_container .download_btn .btn span.left {
float: left;
border-radius: 6px 0 0 6px;
-moz-border-radius: 6px 0 0 6px;
-webkit-border-radius: 6px 0 0 6px;
}
.landing_page .step_container .download_container .download_btn .btn span.title {
-webkit-box-shadow: 0 3px 0 0 #0a2b41;
box-shadow: 0 3px 0 0 #0a2b41;
background-color: #0e3a57;
letter-spacing: 1px;
font-size: 20px;
}
.landing_page .step_container .download_container .download_btn .btn span.right {
float: right;
border-radius: 0 6px 6px 0;
-moz-border-radius: 0 6px 6px 0;
-webkit-border-radius: 0 6px 6px 0;
width: 165px;
}
.landing_page .step_container .download_container .download_btn .btn span.icon,
.landing_page .step_container .download_container .download_btn .btn span.title {
display: block;
position: relative;
line-height: 50px;
padding: 0 30px;
}
.landing_page .step_container .download_container .download_btn .btn.left span.arrow-right {
left: 0;
-webkit-box-shadow: -10px 0 0 0 #071d2b, -10px 3px 0 0 #030e15;
box-shadow: -10px 0 0 0 #071d2b, -10px 3px 0 0 #030e15;
border-left: 10px solid #071d2b;
position: absolute;
width: 0;
height: 0;
border-top: 25px solid transparent;
border-bottom: 25px solid transparent;
-webkit-transition: all .15s;
-transition: all .15s;
-webkit-transition-property: left, right;
transition-property: left, right;
}
.landing_page .step_container .download_container .download_btn .btn:hover span.arrow-right {
left: 5px;
}
&#13;
<html>
<head>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="css/landing_page1.css">
</head><body id="the_body" style="margin:0; height:100%; font-family: 'Lato', sans-serif;">
<div class="landing_page" id="landing_page">
<div class="step_container">
<div class="wrapper clearfix" style="overflow: hidden;">
<div class="download_container">
<div class="down">
<hr>
</div>
<div class="row">
<div class="col_sm_1 zoomIn">
<div class="download_btn download_button">
<a class="btn left">
<span class="left icon icon-lock"></span>
<span class="right title"><span class="arrow-right"></span>Click here</span>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div></body></html>
&#13;