gpt4 book ai didi

javascript - 在 phonegap 中使用 css html 的标签

转载 作者:太空宇宙 更新时间:2023-11-04 15:37:46 28 4
gpt4 key购买 nike

我正在为移动设备使用 css 和 html 制作标签。我当前的代码显示出一些奇怪的行为。我当前的代码显示了如下图所示的选项卡。你看不到所有选项卡都放错了位置,这些选项卡内的图标稍微偏右,但我希望它位于选项卡的中央。我可以将这些图标向左移动,使其出现在 photoshop 的中心,但如果我在大屏幕移动设备上测试这个应用程序,那么这个图标将再次出现在左侧。我希望他们始终处于中心位置。那么请告诉我如何才能像普通移动应用那样制作出更好的标签页?

这是 mu html 代码

<footer>
<ul>
<li class="tabs"><a href="#"></a></li>
<li class="tabs"><a href="#"></a></li>
<li class="tabs"><a href="#"></a></li>
</ul>
</footer>

这是我的CSS

footer {
position: absolute;
z-index: 2;
bottom: 0;
left: 0;
width: 100%;
height: 50px;
padding: 0;
background: #535353;
}
footer ul {
list-style-type: none;
margin: 0;
padding: 0;
}
footer ul li {
display: inline-block;
width: 31%;
height: 50px;
}
footer ul li a {
display: block;
text-decoration: none;
height: 100%;
width: 100%;
background: #fff;
background: url(../../../img/tabs.png) top left no-repeat;
}

这是图片:

image

更新

这是我的新CSS

footer {
position: absolute;
z-index: 2;
bottom: 0;
left: 0;
width: 100%;
height: 50px;
padding: 0;
background: #ccc; }
footer ul {
list-style-type: none;
margin: 0;
padding: 0;
text-align: center; }
footer ul li {
display: block;
float: left;
width: 33.33%;
line-height: 50px;
text-align: center;
overflow: hidden; }
footer ul li a {
display: block;
text-decoration: none;
margin: 1px;
height: 100%;
width: 100%;
background: url(../../../img/tabs.png) center no-repeat;
/*
&.home {
background: url(../../../img/tabs.png) top left no-repeat;
}
&.profile {
background: url(../../../img/tabs.png) top left no-repeat;
}
&.cam {
background: url(../../../img/tabs.png) top left no-repeat;
}*/ }
footer ul li a.current {
margin-top: 5%;
height: 80%;
width: 80%;
background-color: #ccc;
text-indent: -9999px;
border-radius: 5px;
-webkit-box-shadow: inset 0 0 50px #666;
-moz-box-shadow: inset 0 0 50px #666;
box-shadow: inset 0 0 50px #666; }

最佳答案

这是一个demo fiddle .我做了什么

  • text-align: centerul,所以这是继承的,一切都居中
  • line-height 设置为与 width 相同,所以所有内容都垂直居中
  • 列表元素是 display:blockwidth: 33.33%float:left - 我还添加了 overflow:hidden
  • a 元素有 width: 100%margin: 1px

您现在可以通过添加图像和/或真实文本来使用它。

关于javascript - 在 phonegap 中使用 css html 的标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12560114/

28 4 0