如何在所有屏幕尺寸的网页上居中图像 [英] How to center images on a web page for all screen sizes

查看:119
本文介绍了如何在所有屏幕尺寸的网页上居中图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的HTML有问题。我已经在互联网上搜索,但仍然没有真正的答案。

I'm having a problem with my HTML. I've searched all over the internet, but still no real answer.

我有一个网站有一些图像,我希望他们在中间。现在,在我的屏幕上,他们在中间,但这是因为我把他们在那里移动到一边。当我的朋友看着它,图像偏离中心。

I have a website with some images, and I want them to be in the middle. Now, on my screen they're in the middle, but that's because I've put them there by moving them to one side. When my friends to look at it, the image is off-center.

这是网站;

推荐答案

如果你在13.5英寸的屏幕上看起来是在中间。一个简单的< center>< / center> 标签?

Would it not be acceptable to use just a simple <center></center> tag?

我喜欢webdesign,你的网站是非常令人印象深刻的,我可以建议做一些事情来减少加载时间,这是一个关闭。

I must be missing something here if not. Feel free to explain why in a comment. I love webdesign and your site is very impressive. I might suggest doing something to lower the load time, that is a bit of a turn off.

- 从一个MC粉丝到另一个:)

-From one MC fan to another :)

EDIT

我只是看看你的代码...哎哟!

I just took a look at your code... ouch!

<center></center> 

<center><body onload="MM_preloadImages('../logo-glow.png')"> 
<a href="homepage.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('minecraft2','','../logo-glow.png',1)"><img src="../log-noglow.png" name="minecraft2" width="998" height="222" hspace="0" border="0" align="absmiddle" id="minecraft2" /></a></body></center> 

尝试不将格式标签放在正文外。将< center> 放在body标记内。它的工作原理,因为它遵循HTML的低级严格的规则,然而,并不是所有的浏览器都很不错,有些可能会显示您的网页不正确,除非这个问题是固定的!

Try not to put formatting tags outside of the body. Place the <center> inside of the body tag. It works because it follows the low level strict rules of HTML, however, not all browsers are this nice and some might display your page incorrectly unless this problem is fixed!

这篇关于如何在所有屏幕尺寸的网页上居中图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆