gpt4 book ai didi

css - 放置一个偏离侧面的元素?

转载 作者:太空宇宙 更新时间:2023-11-03 17:57:26 27 4
gpt4 key购买 nike

我正在尝试使“FlowerPot”文本居中对齐,但它不起作用。我不知道为什么。也许是 <code>使这一切变得疯狂的元素,但我认为这不会有所作为。这是我的代码:

@import url(http://fonts.googleapis.com/css?family=Lobster+Two:400,400italic);
body {
width: 100%;
background-color: #B10DC9;
overflow-x: scroll;
right: 0;
}
img {
padding-left: 10px;
width: 50px;
z-index: 0;
float: left;
}
code {
position: absolute;
top: 0;
color: white;
z-index: 0;
float: left;
width: 100%;
}
#introdiv {
background-color: blue;
text-align: center;
width: 100%;
padding: 0px;
position: fixed;
z-index: 0;
}
<div id="introdiv">
<img src="http://cakestyle.tv/wp-content/uploads/2013/03/Flower-Pot-no-background-smaller.png"></img>
<code style="font-family:Lobster Two; font-size:60px;">FlowerPot</code>
</div>
请帮忙。我不知道我做错了什么。我需要添加或删除某些内容吗?我需要更改任何内容吗?

如有任何帮助,我们将不胜感激。谢谢!

最佳答案

left:0添加到code

code {
position: absolute;
top: 0;
color: white;
z-index: 0;
float: left;
width: 100%;
left: 0;
}

关于css - 放置一个偏离侧面的元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26030028/

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