所以我目前正在我的网站上工作......并且当我尝试将图像添加到页面时遇到了问题。所以我加入这个起步的主页 -我应该在我的网站上使用什么位置[建议需要]
#titleOne, #paraOne, #paraTwo, #paraThree{
\t text-align: center;
}
<!DOCTYPE html>
\t <html>
\t \t <head>
\t \t \t <link rel="stylesheet" type="text/css" href="style.css">
\t \t </head>
\t <body> \t
<center>
\t \t <h1 id="titleOne">Hello!</h1>
\t \t <p id="paraOne">This is my first website!</p>
\t \t <hr>
\t \t <p id="paraTwo">Hopefully this isn't too boring :/ stay and you might like what you see in the future!</p>
\t \t <p id="paraThree">Fact: I will not stop until I get it done.</p>
</center>
\t </body>
\t </html>
这工作不错,一切都在市中心,看上去很不错!但是现在,当我尝试添加图像并将其添加到中心标签时,它将添加到中心。我不希望那样...我想让图像进入屏幕的右上方,但有几个百分点的间隙,所以它不会卡在屏幕的一侧。我似乎无法做到这一点,因为这样做我必须表明立场:绝对的;当我做所有事情都不合时宜的时候。你们会推荐什么?这是图片代码。
#img {
/*position: absolute;*/
\t width: 100px;
\t height: 100px;
\t border-radius: 100%;
\t -webkit-animation: fadein 2s;
}
@keyframes fadein {
\t from { opacity: 0; }
\t to { opacity: 1; }
}
<img id="img" src="imgs/meFive.JPG" alt="My picture" >
谢谢!
添加绝对定位到一个元素不会敲别的一切不合适的地方,一定有别的东西造成它。 –
中心标记已弃用,因此您应该在DIV中进行转换,并最终通过CSS将文本居中放置。关于图片,请使用float:right – Massimo