简体   繁体   English

将图像放在HTML页面上

[英]positioning an image on an HTML page

Total noob to HTML, So this is probably a really simple solution. 对HTML完全没有知识,所以这可能是一个非常简单的解决方案。

I'm trying to place a gif image at the center and bottom of a web page. 我试图将gif图像放置在网页的中心和底部。 Of course this doesn't happen. 当然这不会发生。

<img src="http://bglradio.net/sam/Web-Images/dancing-girl-6.gif" alt="Dancing Girl" width="160" height="250">

What (If anything) do I need to add to this line to place the image anywhere along its line? 我需要添加什么(如果有的话)以将图像沿其行放置在任何地方?

Thanks in advance Steve 预先感谢史蒂夫

Positioning elements on a page is much easier with CSS. 使用CSS在页面上定位元素要容易得多。 If you're not already comfortable or at least familiar with CSS, I would strongly suggest you go out and find a few of the many, many tutorials out there. 如果您还不熟悉CSS或至少不熟悉CSS,我强烈建议您外出并从中找到许多教程。

To the best of my knowledge, doing this: 就我所知,执行以下操作:

<img src="http://bglradio.net/sam/Web-Images/dancing-girl-6.gif" alt="Dancing Girl" width="160" height="250" style="left: 50%; position: fixed; bottom: 0px; margin-left: -80px">

should center the image perfectly an anchor it to the bottom of the page. 应该使图像完美居中并将其锚定到页面底部。 That is quite a bit of CSS if you're a noob which is why I say again, make sure you start learning CSS. 如果您是菜鸟,那是相当多的CSS,这就是为什么我要再说一遍,请确保您开始学习CSS。

Hope this helps. 希望这可以帮助。

add class to the image to call it through some css like here 

<!DOCTYPE html>
<html>
<head>
<style>

.dancing {
position: absolute;
right: 0px;
bottom: 0px;

}
</style>
</head>
<body><img class="dancing" src="http://bglradio.net/sam/Web-Images/dancing-girl-6.gif" alt="Dancing Girl" width="160" height="250" align="bottom"  >

</body>

</html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM