473,473 Members | 1,954 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Which loads faster?

40 New Member
Hi everyone, quick question:

When I first started my website three months ago, I was a total rookie. I used a lot of <img> tags to create borders around things and to dress up different tables on my site.

Later on, I set classes in a CSS external file and used the background-image: command to fill those same tables with the same images.

So my question is: which is faster? I would think the CSS method. And how much faster is it? Fast enough that I should go back through my entire site and change those <img> tags to style sheet references?

Thanks for the help!
Jan 9 '08 #1
3 1865
astangeland
26 New Member
The main time in loading an image is in connecting to the server and downloading the image. All methods are going to require that, so there is no real gain in speed.

The proper way to decide which way to do it, is to use img tags for images that are part of your content. (A picture that you are talking about in the text, or some other element that would be important to content of the page.) If the image is used only for decorating a page, you should use the background-image attribute.
Jan 9 '08 #2
drhowarddrfine
7,435 Recognized Expert Expert
No, the css method is quicker. I don't have time to explain it all but it has to do with caching of the external css file compared to the html having to find out if the image is old or not. Each image has to be checked in html but in css the whole css file is checked for age. If it's OK then the images are not checked.

Actually, I need to correct that because it's not true for the initial load. In that case, it doesn't matter.

I promised myself I would stay away for two weeks. ;)
Jan 9 '08 #3
garrow
32 New Member
Also

If you remove IMG tags and replace them with a css rule that applies in multiple places, your html code will decrease in size by n X <img> tags and css increases by 1 css declaration.

So good for markup weight as well.
Jan 12 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number....
0
by: mrwoopey | last post by:
Hi, I am using the OLAP data cube in a web browser (using the code from the SQL 2000 toolkit). The OLAP services is on database server and the web interface is on the web server. If we do simple...
65
by: Skybuck Flying | last post by:
Hi, I needed a method to determine if a point was on a line segment in 2D. So I googled for some help and so far I have evaluated two methods. The first method was only a formula, the second...
3
by: Gidi | last post by:
Hello, i writing a application in C#, i have dataGrid that connect to DataSet and DataAdapter that takes data from my sql dataBase, the problem is that the form is loaded very very slow, i heared...
11
by: tinman | last post by:
Hi... I have the following two excerpts from a method. It basically reads data from a DataReader and loads it in a collection. Excerpt A: ******** With ProjectData
7
by: Sunil Varma | last post by:
Is accessing function by it's name faster or accessing it by its address faster?
4
by: Sonnich | last post by:
Hi I have a costum function for a special search, which sort strings. This is currently the place where I can save a lot of time (~70%) if possible. So, which is faster: for($j =...
2
by: PGP | last post by:
I recently derived from a ComboBox to make a countries combo and included it in couple of forms. The derived combo box loads an xml list of countries and uses the DataSource and DisplayMember...
11
by: Mahdi | last post by:
Hi This seems like a crazy question but I wanted to find out if anyone knows which one of those two conditions are better (faster, smaller memory footprint, can be optimized by the compiler,...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.