【发布时间】:2015-07-02 07:01:46
【问题描述】:
我最近学习了 HTML/CSS,因为我突然需要为我的应用创建一个网站。 这个特定的页面非常基础。一个字(大号),后跟一张图片。这两个居中。他们的问题是,当我尝试在他们下方获得“在 App Store 上下载”时。 这是一张图片:
我不确定为什么 App Store 图像卡在其他对象之一中。 我怀疑这与此有关:
display: flex;
-webkit-align-items: center;
align-items: center;
-webkit-justify-content: center;
justify-content: center;
我尝试使用 clear: both;, display: block;填充和诸如此类的东西。似乎没有任何效果,我使用谷歌找不到任何东西。这可能是一个非常基本的问题,或者我做了一些愚蠢的事情。但是,我将非常感谢您提供帮助。
HTML 来了:
<div id="blue">
<div id="ytfil"> ytfil </div>
<div class="imgcontainer"><img id="iphonepicture" src="iphonebluesite.png"> </div>
<div id="container"><img id="appstore" src="App_store_logo.svg"> </div>
</div>
这里我们使用 CSS
#blue{
width: 100%;
height: 100vh;
background-color: #4689D0;
display: flex;
-webkit-align-items: center;
align-items: center;
-webkit-justify-content: center;
justify-content: center;
}
#ytfil{
font-size: 450px;
color: white;
font-family: helvetica;
margin-right: 50px;
}
#iphonepicture {
margin-right: -200px;
}
#container {
display: block;
}
#appstore {
width: 400px;
}
【问题讨论】:
-
你能发布一张图片来展示你想要实现的目标吗?从您的代码/描述中不是很清楚
-
嘿!对此表示歉意。我现在添加了一个 imgur 链接!
-
你的意思是like this? (来源:jsfiddle.net/q35wgpes/2)
-
完全一样,但“ytfil”和 200x450 也垂直居中!感谢您的帮助。