我試圖使用「選擇標籤」實現下拉菜單,但referal image中的下拉菜單將圖像和內容像表格一樣對齊。我已經瀏覽了FAQ,找不到任何相關的答案。正如你所看到的,當你選擇一些東西時,它會直接顯示寫在其中的文本,因爲它應該顯示圖像和內容。請幫助我。在選擇標籤而不是輸入標籤中添加圖像
$(document).ready(function(){
$('#search_iva').click(function(){
$('.drp-result').toggle();
});
});
body {
background-image: url(images/mac.jpg);
font-family: 'Montserrat',sans-serif;
}
.container {
width: 30%;
margin: 50px auto;
padding: 50px;
background: rgba(0, 0, 0, 0.79);
color: #ffffff;
}
h2 {
margin-bottom: 50px;
}
.detail {
display: inline-block;
position: relative;
margin-bottom: 40px;
width: 450px;
}
/*
.detail:after {
content: "\f002";
font-family: Fontawesome;
display: block;
position: absolute;
top: 0;
right: 0;
}*/
.detail input, .detail textarea, .detail select {
display: block;
border: none;
border-bottom: 1px solid #fff;
width: 100%;
background: none;
color: #ffffff;
}
option {
background: rgba(0, 0, 0, 0.8);
}
.detail textarea {
height: 100px;
width: 100%;
overflow: auto;
resize: none;
}
.detail label {
position: absolute;
top: 0px;
left: 5px;
font-size: 16px;
pointer-events: none;
}
.detail .inputBar {
position: relative;
display: block;
}
.detail .inputBar:before,
.detail .inputBar:after {
content: "";
display: block;
position: absolute;
bottom: 0;
width: 0;
background: red;
height: 2px;
transition: all 0.2s ease-in-out;
}
.fa {
display: inline-block;
}
select {
outline: none;
}
.drp-result:before {
border: solid transparent;
content: "\25b2";
position: absolute;
pointer-events: none;
top: -8px;
left: 597px;
color: tan;
}
.drp-result {
display: none;
}
.col {
display: inline-table;
margin-right: 2%;
text-align:center;
}
.col2 {width: 16.6666666667%; vertical-align:middle;}
.col5 {width: 37%;}
.list-item p {
opacity: 0.6;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script rel="text/javascript" src="script.js"></script>
</head>
\t <div class="container">
<h2>Search what you like</h2>
<div class="detail"><select id="search_iva" type="text"><label>I Want to see...</label>
<option>hello1</option>
<option><div class="list-item" style="margin: 30px 0;">
<div class="col col2"><img style="width: 100%;" src="https://image.ibb.co/eSOTqQ/1.jpg"></div>
<div class="col col5"><h4>small doggy</h4></div>
<div class="col col5"><p>Adopt it and express your love</p></div>
</div>
</option>
<option>hello3</option>
<span class="inputBar"></span><!--inputBar-->
</div>
<div class="drp-result">
<div class="result-inner">
<h2>Categories</h2>
<div class="list-item" style="margin: 30px 0;">
<a><div class="col col2"><img style="width: 100%;" src="https://image.ibb.co/eSOTqQ/1.jpg"></div>
<div class="col col5"><h4>small doggy</h4></div>
<div class="col col5"><p>Adopt it and express your love</p></div>
</a></div>
<div class="list-item" style="margin: 30px 0;">
<a><div class="col col2"><img style="width: 100%;" src="https://image.ibb.co/gmkux5/3.jpg"></div>
<div class="col col5"><h4>women</h4></div>
<div class="col col5"><p>A picture of laughing women</p></div>
</a></div>
<div class="list-item" style="margin: 30px 0;">
<a><div class="col col2"><img style="width: 100%;" src="https://image.ibb.co/bWVoPk/2.jpg"></div>
<div class="col col5"><h4>pomolion</h4></div>
<div class="col col5"><p>A rare breed puppy</p></div>
</a></div>
<div class="list-item" style="margin: 30px 0;">
<a><div class="col col2"><img style="width: 100%;" src="https://image.ibb.co/eSOTqQ/1.jpg"></div>
<div class="col col5"><h4>small doggy</h4></div>
<div class="col col5"><p>Adopt it and express your love</p></div>
</a></div>
</div>
</div><!--container-->
</div>
[smallimage]文本纔有效。這是你需要的格式嗎? – Hash
是的,但中等大小的圖像會很好,因爲我鏈接的推薦圖片 –