jedierikb
jedierikb

Reputation: 13089

substitute shorter element name for span?

Wondering if I can substitute different html element tag names and get the original behavior?

For example, could I represent <span/> elements as <s/> and get the same behavior and affordances of <span/>? I am imagining some sort of xslt-esque javascript mapping. Not even sure this is a good idea. I am open to being told this is a bad idea.

Why? I have a big bucket of span tags and would like to reduce my page sizes.

Upvotes: 1

Views: 171

Answers (2)

Dom
Dom

Reputation: 2325

If you wish to reduce page sizes, I would not be looking at this technique (if it's even possible), instead I would format the source code to remove all unnecessary characters (extra spaces add data to be loaded and increase the doc size). Also, make sure your css is a streamlined as possible for example..

If you have many duplicate classes that have to have unique ids, rather than having:

 uniqueclass1{
 width:100px;
 height:100px;
 background:#999;
 }

 uniqueclass2{
 width:100px;
 height:100px;
 background:#999;
 }

You can reduce this to:

 uniqueclass1,
 uniqueclass2{
 width:100px;
 height:100px;
 background:#999;
 }

This will help to reduce the size.

Upvotes: 0

Quentin
Quentin

Reputation: 943591

It is a bad idea. Stick to HTML.

I have a big bucket of span tags and would like to reduce my page sizes.

Use HTTP compression. Repeated chunks of content (such as <span and </span>) compress very well.

Upvotes: 2

Related Questions