我想要这个元素:
<span class="less_options">Weniger Auswahl</span>
next 到按钮而不在它下面。
这是我的jsfiddle:http://jsfiddle.net/1bcnq2Lk/
HTML code:
<div id="search_job_simple" class="form_padding">
<form action="" method="post" class="smart-green">
<fieldset>
<legend>Jobsuche eingrentzen:
<span>Wählen Sie eine "Jobart" und einen "Stadtteil", oder erweitern Sie ihre Suche unter "Mehr Auswahl".</span>
</legend>
<label for="j_select">
<span>Jobart:</span>
<select name="j_select" size="1">
<option>Gelegenheitsjob</option>
<option>Ausbildungsplatz</option>
<option>Praktika</option>
<option>Fachkräfte</option>
<option>Freiemitarbeiter/Freelancer</option>
</select>
</label>
<label for="j_destrict">
<span>Stadtteil:</span>
<select name="j_destrict" size="1">
<option>Charlottenburg</option>
<option>Friedrichshain</option>
<option>Hellersdorf</option>
<option>Hohenschönhausen</option>
<option>Köpenick</option>
<option>Kreuzberg</option>
<option>Lichtenberg</option>
<option>Marzahn</option>
<option>Mitte</option>
<option>Neuköln</option>
<option>Pankow</option>
<option>Prenzlauer Berg</option>
<option>Reinickendorf</option>
<option>Schöneberg</option>
<option>Spandau</option>
<option>Steglitz</option>
<option>Tempelhof</option>
<option>Tiergarten</option>
<option>Treptow</option>
<option>Wedding</option>
<option>Weißensee</option>
<option>Wilmersdorf</option>
<option>Zehlendorf</option>
</select>
</label>
<button type="submit" name="suche_f_btn" class="submit_button">Los!</button>
<span class="more_options">Mehr Auswahl</span>
</fieldset>
和我的CSS代码:
/***********************************************
Alles auf Null setzen
***********************************************/
* {
margin: 0;
padding: 0;
}
body {
background-color: #c0c0c0;
width: 100%;
}
/***********************************************
Header
***********************************************/
#header {
height: 250px;
width: 100%;
background-image: url(../pics/bg.png);
}
#logo {
height: 250px;
background-image: url(../pics/jobber_logo.png);
background-repeat: no-repeat;
background-position:45px 25px;
}
/***********************************************
Navigation
***********************************************/
nav {
width: 100%;
height: 50px;
background-color: yellow;
}
nav ul {
margin: 0;
}
nav ul li {
list-style: none;
float: left;
display: block;
margin: 12px 0 0 50px;
}
/* Links in der Navigation */
nav a:link {
text-decoration: none;
color: #5c5c5c;
font-family: 'Oswald', sans-serif;
font-size: 18px;
}
nav a:visited {
color: #5c5c5c;
}
nav a:hover {
color: black;
border-bottom: 2px solid black;
}
nav a:active {
color: black;
}
/***********************************************
Content
***********************************************/
#content {
clear: left;
background-color: white;
width: 100%;
height: 100%;
}
table {
width: 100%;
border-collapse: collapse;
}
/* Jede zweite Zeile in der Tabelle farbig */
table tr:nth-of-type(odd) td {
background-color: #c0c0c0;
}
th {
background-color: #8dc043;
height: 50px;
border: 2px solid white;
font: 18px "Trebuchet MS", Arial, Helvetica, sans-serif;
color: white;
}
tr {
/*border: 2px solid #47641c;*/
}
td {
border: 2px solid white;
padding: 8px;
background-color: #F8F8F8;
font: 14px Arial, Helvetica, sans-serif;
color: #666;
}
/*sets padding around the table*/
.table_padding {
margin: 0 45px 0 45px;
padding: 45px 0 45px 0;
}
/***********************************************
Footer
***********************************************/
footer {
background-color: #696969;
height: 50px;
}
footer ul li {
list-style: none;
float: left;
display: block;
margin: 12px 0 0 50px;
}
/* Links in der Navigation */
footer a:link {
text-decoration: none;
color: #c0c0c0;
font-family: 'Oswald', sans-serif;
font-size: 16px;
}
footer a:visited {
color: #c0c0c0;
}
footer a:hover {
color: white;
}
footer a:active {
color: white;
}
/***********************************************
Classes
***********************************************/
.more_options {
cursor: pointer;
margin-left: 40px;
}
.less_options {
cursor: pointer;
margin-left: 40px;
}
/***********************************************
ID's
***********************************************/
#wrapper {
margin: 0 auto;
width: 85%;
}
#comments {
margin: 0 45px 0 45px;
padding: 45px 0 25px 0;
}
#f_box {
margin: 0 45px 0 45px;
padding-bottom: 45px;
}
#f_title {
padding: 20px 45px 0 45px;
background-color: #F8F8F8;
font: 16px Arial, Helvetica, sans-serif;
font-weight: bold;
color: #5E5E5E;
}
#f_title span {
float: right;
}
#f_comment {
margin-bottom: 20px;
padding: 0 45px 45px 45px;
background-color: #F8F8F8;
font: 14px Arial, Helvetica, sans-serif;
color: #5E5E5E;
}
#control_center {
color: black;
border-bottom: 2px solid black;
}
#control_center_links {
padding: 45px;
}
/***********************************************
Forms
***********************************************/
.form_padding {
margin: 0 45px 0 45px;
padding-top: 45px;
}
#insert_padding {
margin: 0 45px 0 45px;
padding: 45px 0 45px 0;
}
#form_1, #form_2 {
margin: 0 45px 0 45px;
padding-bottom: 45px;
}
.smart-green {
margin: 0 auto;
background-color: #F8F8F8;
padding-bottom: 1%;
font: 12px Arial, Helvetica, sans-serif;
color: #666;
}
.smart-green fieldset {
border: none;
}
.smart-green legend {
font: 24px "Trebuchet MS", Arial, Helvetica, sans-serif;
padding: 25px 15px 15px 40px;
color: #FFF;
background: #8dc043;
width: 100%;
box-sizing: border-box;
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
}
.smart-green legend>span {
display: block;
font-size: 13px;
color: #FFF;
}
.smart-green label {
display: block;
margin: 10px 40px 5px;
clear: left;
}
.smart-green label>span {
float: left;
margin-top: 10px;
color: #5E5E5E;
}
.smart-green input[type="text"], .smart-green input[type="email"], .smart-green textarea, .smart-green select, .smart-green input[type="password"] {
color: #555;
height: 30px;
line-height:15px;
width: 100%;
padding: 0px 0px 0px 10px;
margin-top: 2px;
border: 1px solid #E5E5E5;
background-color: #FBFBFB;
outline: 0;
-webkit-box-shadow: inset 1px 1px 2px rgba(238, 238, 238, 0.2);
box-shadow: inset 1px 1px 2px rgba(238, 238, 238, 0.2);
font: normal 14px/14px Arial, Helvetica, sans-serif;
}
.smart-green textarea{
height:150px;
padding-top: 10px;
}
.smart-green select {
background: url('down-arrow.png') no-repeat right, -moz-linear-gradient(top, #FBFBFB 0%, #E9E9E9 100%);
background: url('down-arrow.png') no-repeat right, -webkit-gradient(linear, left top, left bottom, color-stop(0%,#FBFBFB), color-stop(100%,#E9E9E9));
appearance:none;
-webkit-appearance:none;
-moz-appearance: none;
text-indent: 0.01px;
text-overflow: '';
width:100%;
height:30px;
}
.smart-green .submit_button {
clear: left;
background-color: #8dc043;
border: none;
margin-left: 40px;
padding: 10px 25px 10px 25px;
color: #FFF;
display: inherit;
}
.smart-green .submit_button:hover {
background-color:#80A24A;
}
.sub_field {
margin-top: 20px;
}
.sub_field legend {
font: 18px "Trebuchet MS", Arial, Helvetica, sans-serif;
color: black;
padding: 10px 10px 10px 40px;
width: 100%;
background-color: yellow;
box-sizing: border-box;
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
}
.radio_matches {
list-style: none;
display: block;
width: 25%;
}
.radio_destrict {
list-style: none;
float: left;
display: block;
}
.radio_destrict li {
width: 25%;
float: left;
margin-bottom: 4px;
}
抱歉,我的英语很差!!希望,有人可以帮助我......:P
答案 0 :(得分:1)
在submit_button
课程中,您设置display: inherit;
,其中包含来自其父级的值,即display: block;
您应该从display: inherit;
课程中删除submit_button
。
答案 1 :(得分:0)
只需将以下内容添加到CSS中:
.submit_button {
float: left;
}
.submit_button + span {
line-height: 32px; /* this will vertical-align your text */
}
答案 2 :(得分:0)
将此:style="display:inline-block;
添加到按钮。 *编辑* 两个按钮
显然,你可以修改margin-left
来拉近文字。也可以通过将display:inline-block;
添加到.smart-green .submit_button
此外,您需要将width:100%
添加到.radio_destrict
,以便按钮不会在大分辨率屏幕上显示。或者查看媒体查询
使用JSFiddle:http://jsfiddle.net/1bcnq2Lk/6/
答案 3 :(得分:0)
将display: inline-block;
添加到按钮以制作元素&#39;流量是水平的而不是垂直的。
.smart-green .submit_button {
...
display: inline-block;
}
答案 4 :(得分:0)
只需将.smart-green .submit_button
的显示更改为inline
,将。.more_options
的显示更改为
答案 5 :(得分:0)
跨度标记是n个内联元素和按钮块元素。要修复此设置,请将跨度显示设置为阻止