小图像与大图像(重复时)
我正在制作一个横跨整个网页的栏(如小时)。出于好奇,创建可能在 X 轴上重复的最小图像不是最好吗或者最好将图像设置为半宽,这样就不必重复太多次了?
I'm making a bar (like an hr) that will be spanning across the webpage. Out of curiosity, would it not be best to create the smallest image possible to repeat on the X axis or would it be best to make the image semi-wide already so that it doesn't have to repeat too many times?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我会让酒吧尽可能小。下载通常比渲染花费更多的时间。不过,在当今世界,这并不那么重要。如果你想让它渲染得更快,我会使用大约 100px 宽度左右的东西。无论哪种方式,对于现代互联网和处理器的速度来说,这都不是什么大问题。
如果可以避免图像,请使用边框。
I would make the bar as small as possible. It takes more time to download than it does to render usually. In today's world is doesn't matter as much, though. If you want to make it render faster, I would use something around 100px width or so. Either way it's not a big deal with the speed of the modern internet and processor.
Use border if you can avoid images.
我的猜测是,速度问题将是 http 请求,而不是重复使用图像的次数。如果图像较小,则下载量较少且查看速度更快。
话虽如此,如果您想复制
,请尝试使用 div 和边框与outset/inset
;My guess is that the speed issue is going to be the http requests not the amount of times an image is used repetitively. If it's a smaller image, less to download and quicker to view.
With that said, if you want to replicate a
<hr/>
try using a div and border withoutset/inset
;我正在寻找备份参考,但我读到 10x10 或 20x20 比 1x1 更可取,因为 HTTP 响应的块大小会导致大致相同的下载时间,并且较大的图像对于浏览器来说布局速度更快。
I am looking for the reference for backup but I read that 10x10 or 20x20 is preferable to 1x1 because the blocksize of the HTTP response would result in roughly the same download time and the bigger image is quicker for the browser to lay out.