我无法使用以下css
在一行中对齐两个文本字段* { margin: 0; padding: 0; outline: none; box-sizing:border-box; }
a>img { border: none; }
header, footer, article, section, nav, aside { display: block; }
/* === General === */
body {
font-family:Arial;
font-size: 14px;
background:#ddd;
}
.clearfix {
clear:both;
}
/* === Credit Card === */
.credit-card {
display:block;
position:relative;
width:93.75%; /* This is 300px on 320px wide screen */
max-width:500px; /* Just to make sure that it doesnt get crazy on bg screens */
min-width:300px; /* And make sure that it contains at least some size */
margin:30px auto;
padding:20px;
overflow:hidden;
border-radius:6px;
z-index:1;
}
.credit-card .inputs {
list-style:none;
margin-top:30px;
}
.credit-card .inputs li {
margin-bottom:30px;
}
.credit-card .inputs li.last {
margin-bottom:10px;
}
.credit-card .inputs li.expire {
float:left;
width:70%;
margin-right:5%;
}
.credit-card .inputs li.expire input{
float:left;
width:35%;
}
.credit-card .inputs li.expire input.month{
width:30%;
margin-right:5%;
}
.credit-card .inputs li.cvc-code {
float:right;
width:20%;
}
.creditcatd .inputs ul.cvc-code{
display: inline;
}
.credit-card .inputs li.cvc-code input {
width:70%;
}
.credit-card .visa-watermark, .credit-card .mastercard-watermark {
position:absolute;
z-index:10;
display: none;
}
.credit-card form {
position:relative;
z-index:50;
}
.credit-card .visa-logo, .credit-card .mastercard-logo {
position:absolute;
top:15px;
right:20px;
text-transform:uppercase;
font-weight:bold;
display: none;
}
/* === Visa === */
.visa {
color:#fff;
box-shadow: 0px 0px 4px rgba(0,0,0,0.8), inset 0px 1px 3px rgba(255,255,255,0.3), inset 0px 0px 2px rgba(255,255,255,0.2);
}
.visa h2 {
text-shadow:1px 1px 2px rgba(17,121,173,0.8);
}
.visa .visa-logo {
color:rgba(255,255,255,0.9);
font-size:2em;
font-style:italic;
text-shadow:0px 0px 3px rgba(17,123,173,0.9);
display: block;
}
.visa .logo:after {
content:' ';
position:absolute;
left:0px;
top:5px;
width: 0;
height: 0;
border-top: 10px solid orange;
border-left: 10px solid transparent;
}
.visa .visa-watermark {
display: block;
bottom:-100px;
left:-50px;
color:rgba(255,255,255,0.06);
font-size:20em;
font-weight:bold;
font-style:italic;
}
/* === Mastercard === */
.mastercard {
color:#fff;
box-shadow: 0px 0px 4px rgba(0,0,0,0.8), inset 0px 1px 3px rgba(255,255,255,0.3), inset 0px 0px 2px rgba(255,255,255,0.3);
}
.mastercard h2 {
text-shadow:0px 1px 1px #2D4DAA;
}
.mastercard label {
color:rgba(255,255,255,0.7);
text-shadow:0px 1px 1px rgba(0,0,0,0.4);
}
.mastercard input {
border:1px solid rgba(39,70,157,0.8);
}
.mastercard .mastercard-logo {
display: block;
}
.mastercard .mastercard-logo div {
float:left;
width:25px;
height:25px;
border-radius:15px;
background:rgba(239,209,57,0.8);
}
.mastercard .mastercard-logo div:first-child
{
background:rgba(223,40,40,0.8);
margin-right:-10px;
}
.mastercard .mastercard-watermark {
display: block;
bottom:-130px;
left:15%;
}
.mastercard .mastercard-watermark div {
float:left;
width:200px;
height:200px;
border-radius:100px;
background:rgba(239,209,57,0.1);
}
.mastercard .mastercard-watermark div:first-child {
background:rgba(223,40,40,0.1);
margin-right:-60px;
}
.mastercard .demo
{
float:left;
width:200px;
height:200px;
border-radius:100px;
background:rgba(239,209,57,0.1);
}
/* === Forms === */
label {
display:block;
margin-bottom:8px;
color:rgba(255,255,255,0.6);
text-transform:uppercase;
font-size:1em;
font-weight:bold;
text-shadow:0px 1px 2px rgba(17,123,173,0.6);
}
input {
display:block;
padding:10px 8px;
color:#999;
font-size:1em;
font-weight:bold;
text-shadow:1px 1px 1px #fff;
border:1px solid rgba(16,103,133,0.6);
box-shadow:0px 0px 3px rgba(255,255,255,0.5), inset 0px 1px 4px rgba(0,0,0,0.2);
border-radius:3px;
}
input.full {
width:100%;
}
/* === Gradients === */
.visa.gr-cards {
background: #1db1cf; /* Old browsers */
background: -moz-linear-gradient(top, #1db1cf 0%, #1078ab 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1db1cf), color-stop(100%,#1078ab)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #1db1cf 0%,#1078ab 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #1db1cf 0%,#1078ab 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #1db1cf 0%,#1078ab 100%); /* IE10+ */
background: linear-gradient(to bottom, #1db1cf 0%,#1078ab 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1db1cf', endColorstr='#1078ab',GradientType=0 ); /* IE6-9 */
}
.mastercard.gr-cards {
background: #4d86ce; /* Old browsers */
background: -moz-linear-gradient(top, #4d86ce 0%, #2d4daa 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#4d86ce), color-stop(100%,#2d4daa)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #4d86ce 0%,#2d4daa 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #4d86ce 0%,#2d4daa 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #4d86ce 0%,#2d4daa 100%); /* IE10+ */
background: linear-gradient(to bottom, #4d86ce 0%,#2d4daa 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4d86ce', endColorstr='#2d4daa',GradientType=0 ); /* IE6-9 */
}
.gr-input {
background: #d3d3d3; /* Old browsers */
background: -moz-linear-gradient(top, #d3d3d3 0%, #d9d9d9 38%, #e5e5e5 82%, #e7e7e7 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#d3d3d3), color-stop(38%,#d9d9d9), color-stop(82%,#e5e5e5), color-stop(100%,#e7e7e7)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #d3d3d3 0%,#d9d9d9 38%,#e5e5e5 82%,#e7e7e7 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #d3d3d3 0%,#d9d9d9 38%,#e5e5e5 82%,#e7e7e7 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #d3d3d3 0%,#d9d9d9 38%,#e5e5e5 82%,#e7e7e7 100%); /* IE10+ */
background: linear-gradient(to bottom, #d3d3d3 0%,#d9d9d9 38%,#e5e5e5 82%,#e7e7e7 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d3d3d3', endColorstr='#e7e7e7',GradientType=0 ); /* IE6-9 */
}
/* General button style (reset) */
.btn {
border: none;
font-family: inherit;
font-size: inherit;
color: inherit;
background: none;
cursor: pointer;
padding: 1px 5px;
display: inline-block;
margin: 0px 0px;
text-transform: uppercase;
letter-spacing: 0px;
font-weight: 700;
outline: none;
position: relative;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
transition: all 0.3s;
}
.btn:after {
content: '';
position: absolute;
z-index: -1;
-webkit-transition: all 0.3s;
-moz-transition: all 0.3s;
transition: all 0.3s;
}
/* Pseudo elements for icons */
.btn:before,
.icon-heart:after,
.icon-star:after,
.icon-plus:after,
.icon-file:before {
font-family: 'icomoon';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
position: relative;
-webkit-font-smoothing: antialiased;
}
.icon-envelope:before {
content: "\e000";
}
.icon-cart:before {
content: "\e007";
}
.icon-cart-2:before {
content: "\e008";
}
.icon-heart:before {
content: "\e009";
}
/* Filled heart */
.icon-heart:after,
.icon-heart-2:before {
content: "\e00a";
}
.icon-star:before {
content: "\e00b";
}
/* Filled star */
.icon-star:after,
.icon-star-2:before {
content: "\e00c";
}
.icon-arrow-right:before {
content: "\e00d";
}
.icon-arrow-left:before {
content: "\e003";
}
.icon-truck:before {
content: "\e00e";
}
.icon-remove:before {
content: "\e00f";
}
.icon-cog:before {
content: "\e010";
}
.icon-plus:before,
.icon-plus:after {
content: "\e011";
}
.icon-minus:before {
content: "\e012";
}
.bh-icon-smiley:before {
content: "\e001";
}
.bh-icon-sad:before {
content: "\e002";
}
.icon-file:before {
content: "\e004";
}
.icon-remove-2:before {
content: "\e005";
}
/* Button 1 */
.btn-1 {
border: 2px solid #fff;
color: #fff;
}
/* Button 1e */
.btn-1e {
overflow: hidden;
}
.btn-1e:after {
width: 100%;
height: 0;
top: 50%;
left: 50%;
background: #fff;
opacity: 0;
-webkit-transform: translateX(-50%) translateY(-50%) rotate(45deg);
-moz-transform: translateX(-50%) translateY(-50%) rotate(45deg);
-ms-transform: translateX(-50%) translateY(-50%) rotate(45deg);
transform: translateX(-50%) translateY(-50%) rotate(45deg);
}
.btn-1e:hover,
.btn-1e:active {
color: #0e83cd;
}
.btn-1e:hover:after {
height: 260%;
opacity: 1;
}
.btn-1e:active:after {
height: 400%;
opacity: 1;
}
/* Button 1c */
.btn-1c:after {
width: 0%;
height: 100%;
top: 0;
left: 0;
background: #fff;
}
.btn-1c:hover,
.btn-1c:active {
color: #1BA7C9;
}
.btn-1c:hover:after,
.btn-1c:active:after {
width: 100%;
}
.dropdown {
display: inline-block;
position: relative;
overflow: hidden;
height: 28px;
width: 150px;
background: #f2f2f2;
border: 1px solid;
border-color: white #f7f7f7 #f5f5f5;
border-radius: 3px;
background-image: -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, 0.06));
background-image: -moz-linear-gradient(top, transparent, rgba(0, 0, 0, 0.06));
background-image: -o-linear-gradient(top, transparent, rgba(0, 0, 0, 0.06));
background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.06));
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}
.dropdown:before, .dropdown:after {
content: '';
position: absolute;
z-index: 2;
top: 9px;
right: 10px;
width: 0;
height: 0;
border: 4px dashed;
border-color: #888 transparent;
pointer-events: none;
}
.dropdown:before {
border-bottom-style: solid;
border-top: none;
}
.dropdown:after {
margin-top: 7px;
border-top-style: solid;
border-bottom: none;
}
.dropdown-select {
position: relative;
width: 130%;
margin: 0;
padding: 6px 8px 6px 10px;
height: 28px;
line-height: 14px;
font-size: 12px;
color: #62717a;
text-shadow: 0 1px white;
/* Fallback for IE 8 */
background: #f2f2f2;
/* "transparent" doesn't work with Opera */
background: rgba(0, 0, 0, 0) !important;
border: 0;
border-radius: 0;
-webkit-appearance: none;
}
.dropdown-select:focus {
z-index: 3;
width: 100%;
color: #394349;
outline: 2px solid #49aff2;
outline: 2px solid -webkit-focus-ring-color;
outline-offset: -2px;
}
.dropdown-select > option {
margin: 3px;
padding: 6px 8px;
text-shadow: none;
background: #f2f2f2;
border-radius: 3px;
cursor: pointer;
}
/* Fix for IE 8 putting the arrows behind the select element. */
.lt-ie9 .dropdown {
z-index: 1;
}
.lt-ie9 .dropdown-select {
z-index: -1;
}
.lt-ie9 .dropdown-select:focus {
z-index: 3;
}
/* Dirty fix for Firefox adding padding where it shouldn't. */
@-moz-document url-prefix() {
.dropdown-select {
padding-left: 6px;
}
}
.fsSubmitButton
{
float:left;
width:20%;
padding: 7px 12px 8px !important;
font-size: 15px !important;
background-color: #57d6c7;
font-weight: bold;
text-shadow: 1px 1px #57D6C7;
color: #ffffff;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border: 1px solid #57D6C7;
cursor: pointer;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
-moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
}
.fsSubmitButtonM
{
float:left;
width:20%;
padding: 7px 12px 8px !important;
font-size: 15px !important;
background-color: #3dbdae;
font-weight: bold;
text-shadow: 1px 1px #57D6C7;
color: #ffffff;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border: 1px solid #57D6C7;
cursor: pointer;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
-moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
}
/* === Card Selection === */
.card-select {
margin-bottom:40px;
}
.card-select h2 {
font-size:1.5em;
color:#555;
text-shadow:1px 1px 1px rgba(255,255,255,0.2);
}
.card-select .wrap {
width:300px;
margin:20px auto;
padding:10px;
border:1px solid #A0A0A0;
background:rgba(176,176,176,0.4);
border-radius:6px;
box-shadow:0px 0px 2px rgba(0,0,0,0.5);
}
.card-select a {
text-decoration:none;
}
.card-select a img {
width:15%;
}
/* === Cards === */
.cards {list-style:none;}
.cards>li {display:none;}
.cards>li.active {display:block;}
我的HTML是
<body>
<section id='cards' class="credit-card visa gr-cards">
<div class="logo visa-logo">visa</div>
<div class="logo mastercard-logo"><div></div><div></div></div>
<form action="./credit.php" method="post">
<input id="txtEncryptionKey" name="txtEncryptionKey" class="tokenex_encryptionkey"
type="hidden" value="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvWpIQFjQQCPpaIlJKpeg
irp5kLkzLB1AxHmnLk73D3TJbAGqr1QmlsWDBtMPMRpdzzUM7ZwX3kzhIuATV4Pe
7RKp3nZlVmcrT0YCQXBrTwqZNh775z58GP2kZs+gVfNqBampJPzSB/hB62KkByhE
Cn6grrRjiAVwJyZVEvs/2vrxaEpO+aE16emtX12RgI5JdzdOiNyZEQteU6zRBRJE
ocPWVxExaOpVVVJ5+UnW0LcalzA+lRGRTrQJ5JguAPiAOzRPTK/lYFFpCAl/F8wt
oAVG1c8zO2NcQ0Pko+fmeidRFxJ/did2btV+9Mkze3mBphwFmvnxa35LF+Cs/XJH
DwIDAQAB" />
<button name="cc" class="btn btn-1 btn-1c">Credit Card</button>
<button class="btn btn-1 btn-1c">Debit Card</button>
<button class="btn btn-1 btn-1c">Internet Banking</button>
<ul class="inputs">
<li>
<label>Card Number</label>
<input type="text" name="cardnumber" pattern="[0-9]{13,16}" class="class=tokenex_data full gr-input" required />
</li>
<li>
<label>Name on card</label>
<input type="text" name="card_name" size="20" class="month gr-input" required />
<label>Card Type</label>
<div class="dropdown">
<select name="one" class="dropdown-select month gr-input">
<option value="1">Visa</option>
<option value="2">Mastercard</option>
</select>
</div>
</li>
<li class="expire last">
<label>Expiration</label>
<div class="dropdown">
<select name="one" class="dropdown-select month gr-input">
<option value="">Month</option>
<option value="1">Jan</option>
<option value="2">Feb</option>
<option value="3">Mar</option>
<option value="4">Apr</option>
<option value="5">May</option>
<option value="6">Jun</option>
<option value="7">Jul</option>
<option value="8">Aug</option>
<option value="9">Sep</option>
<option value="10">Oct</option>
<option value="11">Nov</option>
<option value="12">Dec</option>
</select>
</div>
<div class="dropdown">
<select name="one" class="dropdown-select year gr-input">
<option value="">Year</option>
<option value="2013">2013</option>
<option value="2014">2014</option>
<option value="2015">2015</option>
<option value="2016">2016</option>
<option value="2017">2017</option>
<option value="2018">2018</option>
<option value="2019">2019</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
<option value="2022">2022</option>
<option value="2023">2023</option>
<option value="2024">2024</option>
</select>
</div>
<div class="clearfix"></div>
</li>
<li class="cvc-code last">
<label>CVV Code</label>
<input type="text" name="cvc_code" value="174" size="10" class="gr-input" required />
</li>
<input type="submit" name="tokenex_process" value="Pay Now" class="fsSubmitButton tokenex_submit btn btn-success"/>
<div class="clearfix"></div>
</ul>
</form>
<div class="visa-watermark">visa</div>
<div class="mastercard-watermark"><div></div><div></div></div>
</section>
</body>
我希望“卡片上的名字”和“卡片类型”排成一行..我尝试将它们放在
请在这里找到一个好消息http://jsfiddle.net/f8Fd3/10/
答案 0 :(得分:1)
您可以使用float
css属性。您需要添加一些div
来将标签和文本框组合在一起
见fiddle
HTML:
<li>
<div>
<div style="float: left;">
<label>Name on card</label>
<input type="text" name="card_name" size="20" class="month gr-input" required />
</div>
<div style="float: right; margin-right: 80px">
<label>Card Type</label>
<div class="dropdown">
<select name="one" class="dropdown-select month gr-input">
<option value="1">Visa</option>
<option value="2">Mastercard</option>
</select>
</div>
</div>
</div>
</li>
答案 1 :(得分:1)
小提琴:http://jsfiddle.net/logintomyk/Td2ug/
简单地推荐如下:
<label style="float:left">Name on card
<input type="text" name="card_name" size="20" class="month gr-input" required />
</label>
<label style="float:left">Card Type <br>
<div class="dropdown">
<select name="one" class="dropdown-select month gr-input">
<option value="1">Visa</option>
<option value="2">Mastercard</option>
</select>
</div>
</label>
覆盖input
内的label
和float
left
,它们将排成一行!
答案 2 :(得分:1)
试试这个
我将这个html和类添加到你的html
<li class="card-name">
<label>Name on card</label>
<input type="text" name="card_name" size="20" class="month gr-input" required />
</li>
<li class="card-type">
<label>Card Type</label>
<div class="dropdown">
<select name="one" class="dropdown-select month gr-input">
<option value="1">Visa</option>
<option value="2">Mastercard</option>
</select>
</div>
</li>
我将此css添加到您的CSS
.credit-card .inputs li.card-name , .credit-card .inputs li.card-type {
display:block;
float:left;
margin-bottom:30px;
}
.credit-card .inputs li.card-type {
margin-left:20px;
}
并且也看到了这个jsfiddle。