【发布时间】:2018-01-07 11:31:33
【问题描述】:
这里是 div 中的一个元素。我使用媒体查询使它们居中并以全宽内联,我的意思是最小宽度 701 像素,并使它们在 700 像素下被阻止显示。居中工作,但它没有显示在块显示中,而是显示在一行中。但我写道: display: block !important;在 .kdown 演示中:http://buhehe.de/kalender-2018/ 我的意思是日历下的下载按钮 html:
<div class="kdown" id="kdown">
<h6> Kalender 2018 Ausdrucken , Download als PDF, Word, Excel oder PNG:</h6>
<a target="_blank" class="pngg" href="http://buhehe.de/wp-content/kalender-2018.png">
<img src="http://buhehe.de/wp-content/uploads/2018/01/png-img.png" alt="PNG" />
<span>Download in PNG</span>
</a>
<a class="pdff" target="_blank" href="http://buhehe.de/wp-content/kalender-2018.pdf">
<img src="http://buhehe.de/wp-content/uploads/2018/01/pdf-img.png" alt="PDF" />
<span>Download in PDF</span>
</a>
<a target="_blank" class="wordd" href="http://buhehe.de/wp-content/kalender-2018.docx">
<img src="http://buhehe.de/wp-content/uploads/2018/01/word-img.png" alt="Word" />
<span>Download in Word</span>
</a>
<a target="_blank" class="excell" href="http://buhehe.de/wp-content/kalender-2018.xlsx">
<img src="http://buhehe.de/wp-content/uploads/2018/01/Excel-img.png" alt="Excel" />
<span>Download in Excell</span>
</a>
</div>
css:
@media screen and (max-width: 700px) {
.traki {
margin-left: 0px !important;
text-align: center !important;
}
.kdown p span {
position: relative;
top: -1px !important;
}
.kdown h6 {
font-size: 15px !important;
}
.kdown p {
display: block !important;
}
}
@media screen and (min-width: 701px) {
.kdown p {
display: inline !important;
}
.kdown {
text-align: center !important;
}
}
.kdown a {
width: 160px;
background-color: #FF9900;
color: #FFFFFF;
border-radius: 4px !important;
height:40px;
padding: 10px 3px 10px 5px ;
}
.kdown a:not(:first-child) {
margin-left: 3px;
}
.kdown a:hover {
opacity: 0.8;
color: #ffffff !important;
}
.kdown p img {
width: 25px;
padding-right: 3px;
height: 25px;
position: relative;
top: 7px;
}
【问题讨论】: