减小 html 大小
有人对如何减小主页大小有建议吗 http://www.floorsandchores.net
Does anyone have a suggestion on how i can reduce my home page size please
http://www.floorsandchores.net
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
所有其他答案都是正确的,但您可以进行额外的微调。 ;-)
1.) 你有一百万零一个不间断的空格用于对齐...使用 CSS 而不是这个:
2.) 必须有一些比 1999 年左右的 Macromedia 预加载器更好的图像预加载。
3.) 使用服务器端注释,这些注释不会被推送到客户端
4.) 您的代码中有大量空的
onclick=""
处理程序。如果你不需要它们,就把它们撕下来。5.) 删除所有空的
font
标签、强标签以及未使用的 div6.) 除非您将其覆盖为内联,否则不需要添加
display:block
到你的 div7.) 你的 favicon 是一个 BMP 文件...它应该是 IE 的 ICO(和/或现代浏览器的 PNG)
8.) 删除右键单击拦截器 - 没有意义不再在其中了。所有浏览器都会以您无法阻止的方式完全公开整个 HTML/JS/CSS,供任何人查看。
9.) 删除/重构针对 IE4 和 Netscape6 的 JavaScript - 这两个浏览器几年前就已经消失了
10.) 你已经声明了这个元标记两次...
11.) 您可能不需要在链接上使用此内容:
target="_self"
All of the other answers are correct, but there is additional fine tuning you can do. ;-)
1.) You have a million-and-one non-breaking spaces used to do alignment... use CSS instead of this:
2.) There has to be some better image preloading than the Macromedia preloaders from circa 1999.
3.) Use server-side comments, that don't get pushed to the client
4.) You have a ton of empty
onclick=""
handlers in your code. If you don't need them, rip them out.5.) Delete all your empty
font
tags, and strong tags, and divs that aren't being used6.) Unless you overrode it to be inline, you don't need to add
display:block
to your div's7.) Your favicon is a BMP file... it should be ICO for IE (and/or PNG for modern browsers)
8.) Drop the right-click blocker - there's no point in it anymore. All browsers fully expose the entire HTML/JS/CSS for anyone to see in ways you can't block.
9.) Remove/Refactor the JavaScript that is targetting IE4 and Netscape6 - both of these browsers died years ago
10.) You have this meta tag declared twice...
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
11.) You likely don't need this on the links:
target="_self"
如果您使用 YSlow 或 Google Page Speed 他们会告诉您哪种优化可以提高网站的性能。我可以看出你没有对你的 html、js 文件等进行 gzip:ing。打开 gzip 将大大减少下载到客户端的大小。
If you use a tool such as YSlow or Google Page Speed they will tell you what kind of optimizations that would increase the performance of your site. I can tell that your not gzip:ing your html, js-files and so on. Turning on gzip will reduce the size that gets downloaded to the client drastically.
您是否正在考虑以千字节为单位的大小?
您的页面当前大小为 182K。这还不是很多。
要了解您网站的大小或了解如何优化加载速度,我建议 firebug for firefox 和 yahoo 的 yslow (添加到 firebug) - 它会告诉您可以了解页面大小、如何优化网站等。
根据 YSlow 的说法,您目前的成绩为
C
,这还算不错。页面加载速度
如果您正在考虑加快网站速度,有几种方法。
要加快页面速度,您可以执行以下操作:
标记之前
.htaccess
中执行此操作文件(至少在 apache 服务器上)——这不会影响新用户,但经常来的用户会感觉到不同。GZip 压缩
您可以在您的网站上启用 gzip 压缩。有一个 apache 插件 - 但不确定你的主机是否兼容。但这会大大减小尺寸。
Are you thinking about size in kilobytes?
Your page is currently 182K. That's not a whole lot.
To find out the size of your site of find out how to optimize the loading speed, I recommend firebug for firefox and yahoo's yslow (add on to firebug) - it will tell you the page size, how you can optimize the site etc.
According to YSlow, you're currently getting a grade of
C
, which isn't so bad.Page loading speed
If you're thinking about speeding your site up, there are a few ways.
To speed up the page you can do a few things:
</body>
tag.htaccess
file (on apache servers at least) - this won't affect new users, but users that come often will feel a difference.GZip compression
You could enable gzip compression on your website. There is a plugin for apache - but it's not certain that your host is compatible. But this will reduce the size considerably.
相对而言,这不是一个很大的文档,但如果我的员工提交代码进行审查,我会告诉他们:
自动生成?)你可以
尽量减少您发送的内容
使用 JQuery 处理每个请求
或者在诸如翻转之类的情况下
图片,纯CSS。
font-size: 10px;
,该元素在页面上内嵌了 17 次。只需为字体设置一个 CSS 属性,font-size=10px(或者更好的是,为 html 设置一个 CSS 属性并为子选择器设置百分比)It isn't a huge document relatively speaking, but here's what I'd tell my employees if they presented the code for review:
to be auto-generated?) and you could
minimize what you're sending across
on each request by utilizing JQuery
or in cases such as the rollover
images, pure CSS.
font-size: 10px;
which is done 17 times in-line on the page. Just set a CSS property for font with font-size=10px (or better yet, set one for the html and do percentages for child selectors)