【发布时间】:2013-12-05 16:04:41
【问题描述】:
我有以下 HTML 页面。在此页面中,我在桌面和移动浏览器中面临不同的问题。
在桌面浏览器中所有内容都显示,但图像太大。如果我试图让它变小,那么它对于移动设备来说就会变得很小。那么如何实现它,使图标变得适合这两个地方呢?
在移动浏览器
border-bottom-style中不显示,但在桌面浏览器中显示。那么问题出在哪里?
HTML:
<body style="height:100%">
<table width="100%" height="100%" cellpadding="0" cellspacing="0" style="position: absolute; top: 0; bottom: 0; left: 0; right: 0;" class="homebackground">
<tr height="10%">
<td colspan="3" style="background:url(../../stylesheets/images/user_male.png) no-repeat; background-size: contain;border-bottom-style:solid;border-color: #129AA2; border:1"> </td>
</tr>
<tr height="80%" style="background:url(../../stylesheets/images/Logo_with_Blu_bg.png); background-size:98% 88%;">
<td colspan="3">
<table style="width:100%; height:100%;" border="0" cellpadding="0" cellspacing="0">
<tr style="height:20%;">
<td align="right" class="mainbodyup"><img src="../../stylesheets/images/phone.png"/></td>
<td> </td>
<td class="mainbodyup"><img src="../../stylesheets/images/groupchat.png"/></td>
</tr>
<tr height="60%">
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr height="20%">
<td class="mainbodyup"><img src="../../stylesheets/images/recent.png"/></td>
<td> </td>
<td class="mainbodyup"><img src="../../stylesheets/images/search.png"/></td>
</tr>
</table>
</td>
</tr>
<tr height="10%">
<td colspan="3" style="background:url(../../stylesheets/images/setting_footer.png) no-repeat; background-size: contain;border-top-style:solid;border-color: #129AA2; border:1"> </td>
</tr>
</table>
</body>
CSS:
@media only screen and (min-width: 768px) {
.mainbodyup
{
height:20%;
width:33%;
padding:0px;
}
.mainbodyup img
{
max-width:30%;
margin:auto;
display:block;
}
}
@media only screen and (min-width: 100px) {
.mainbodyup
{
height:20%;
width:33%;
padding:0px;
}
.mainbodyup img
{
max-width:100%;
margin:auto;
display:block;
}
}
稍后编辑
我将我的 CSS 更改为媒体查询。现在我面临的问题是最后一个媒体查询是有效的。如果我交换然后结果也是一样的。两个查询单独工作正常但是如果我把它们放在一起那么最后一个是有效的,那么问题是什么?
【问题讨论】:
标签: html css mobile media-queries