gpt4 book ai didi

HTML/CSS(快速拨号)

转载 作者:太空宇宙 更新时间:2023-11-03 18:10:31 24 4
gpt4 key购买 nike

我是 HTML/CSS 的初学者,只是在练习一些东西。我正在制作类似于 Google Chrome 快速拨号 2 的快速拨号。我只是有一些问题需要您的帮助。

这是它的代码。我现在想要的就是这个表盘,在这个 Picture 中概述要在左侧,不要居中。

ul.main{            
text-align: center;
}

这就是它居中的原因,但是如果我删除它,那么整个 ul 标签都会向左移动...我希望最终结果像那样Video Example

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Speed Dials Test</title>
<style type="text/css">
body{
background-color: black;
background-image: url(322423.jpg);
background-size: cover;
background-repeat: no-repeat;
background-position-y: 15%;
}


ul.main{
list-style-type: none;
display: table;
padding:0;
clear: both;
margin: 0 auto;
text-align: center;
}

li.dial{
width: 300px;
height: 200px;
display: inline-table;
box-sizing: border-box;
padding: 10px;
outline:0;
margin:0;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
border-radius: 12px;
}

li.dial a:hover{
opacity: 0.75;
}

li.dial a{
width: 100%;
height: 100%;
background-color: #BADAFF;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
border-radius: 12px;
padding: 10px;
display: table-cell;
text-decoration: none;
color:#0000FF;
}

li.dial a:active{
color:#0000FF;
}

.dial .site{
font-size: 13px;
}

li.dial div.thumb{
background-color: #fff;
width: 100%;
height: 90%;
border-top-right-radius: 10px;
border-top-left-radius: 10px;
display: block;
background-size: contain;
background-repeat: no-repeat;
background-position: 50% 50%;
}

li.dial div.site{
background-color: transparent;
width: 100%;
height: 14%;
display: block;
padding-top: 3px;
text-align: center;
}



@media only screen and (min-width : 150px) and (max-width : 1245px){
ul.main{
width: 1099px;
}

li.dial{
width: 260px;
height: 175px;
}
}

@media only screen and (min-width : 150px) and (max-width : 1110px){
ul.main{
width: 978px;
}

li.dial{
width: 230px;
height: 152px;
}
}

@media only screen and (min-width : 150px) and (max-width : 986px){
ul.main{
width: 843px;
}

li.dial{
width: 200px;
height: 132px;
}
}

@media only screen and (min-width : 150px) and (max-width : 855px){
ul.main{
width: 750px;
}

li.dial{
width: 160px;
height: 110px;
}

@media only screen and (min-width : 150px) and (max-width : 760px){
ul.main{
width: 97%;
}

li.dial{
width: 160px;
height: 110px;
}
}

</style>
</head>
<body>

<ul class="main">
<li class="dial">
<a href="http://facebook.com" target="_self">
<div class="thumb" style="background-image:url(http://i.imgur.com/yIeoHS5.png)"></div>
<div class="site">Facebook</div>
</a>
</li>
<li class="dial">
<a href="http://google.com" target="_self">
<div class="thumb" style="background-image: url(http://farm6.static.flickr.com/5221/5612548667_a9b09a2068_o.png)"></div>
<div class="site">Google</div>
</a>
</li>
<li class="dial">
<a href="#">
<div class="thumb" style="background-image: url(http://png-4.findicons.com/files/icons/2561/1st_mx_is_4c/256/speed_dial2.png)"></div>
<div class="site">Gmail.com</div>
</a>
</li>
<li class="dial">
<a href="#">
<div class="thumb" style="background-image: url(http://png-4.findicons.com/files/icons/2561/1st_mx_is_4c/256/speed_dial2.png)"></div>
<div class="site">Yahoo</div>
</a>
</li>
<li class="dial">
<a href="#">
<div class="thumb" style="background-image: url(http://png-4.findicons.com/files/icons/2561/1st_mx_is_4c/256/speed_dial2.png)"></div>
<div class="site">TheNewBoston</div>
</a>
</li>
<li class="dial">
<a href="#">
<div class="thumb" style="background-image: url(http://png-4.findicons.com/files/icons/2561/1st_mx_is_4c/256/speed_dial2.png)"></div>
<div class="site">PHPacademy</div>
</a>
</li>
<li class="dial">
<a href="#">
<div class="thumb" style="background-image: url(http://png-4.findicons.com/files/icons/2561/1st_mx_is_4c/256/speed_dial2.png)"></div>
<div class="site">Geo.saitebi.ge</div>
</a>
</li>
<li class="dial">
<a href="#">
<div class="thumb" style="background-image: url(http://png-4.findicons.com/files/icons/2561/1st_mx_is_4c/256/speed_dial2.png)"></div>
<div class="site">W3Schools</div>
</a>
</li>

<li class="dial">
<a href="#">
<div class="thumb" style="background-image: url(http://png-4.findicons.com/files/icons/2561/1st_mx_is_4c/256/speed_dial2.png)"></div>
<div class="site">Seo.ge</div>
</a>
</li>
</ul>

</body>
</html>

最佳答案

创建一个空的 div,类为 clean,值为 clear: both;此属性禁止换行。 both 从左右边缘同时取消环绕元素。当您需要移除包裹元素时,建议使用此值,但不知 Prop 体是哪一侧。或者仍然拒绝 text-align: center;

关于HTML/CSS(快速拨号),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23829270/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com