How to Make Longer HTML Codes Into Short Codes


The longer individual HTML codes are within an HTML document, the more confusing and convoluted the document appears, particularly if you don't have a great deal of coding experience. Overlong HTML codes are additionally problematic if the field you need to paste your code has a character limit. No matter your reason for wanting to do so, shorten and consolidate codes whenever possible.

  • Use relative pathnames whenever possible. For example, if you insert a link to a file hosted at and are currently editing, use the relative path "files/file1.jpg" rather than the full Web address to shorten the code.

  • Consolidate features such as alignment and display size within a page element, rather than outside of it. Rather than centering an image like this, for example:

    <center><img src="files/file1.jpg></img></center>


    <img src="files/file1.jpg" align="center"></img>

  • Remove HTML tables and use paragraph or line break tags instead. For example, rather than placing two linked images on separate lines this way:



      &lt;td>&lt;a href="">&lt;img src="">&lt;/img>&lt;/a>


    &lt;td>&lt;a href="">&lt;img src="">&lt;/img>&lt;/a>



    Do this:

    <p><a href="&lt;img">">&lt;img src="&lt;/img>&lt;/a>&lt;/p">">&lt;/img>&lt;/a>&lt;/p>

    <p><a href="&lt;img">">&lt;img src="&lt;/img>&lt;/a>&lt;/p">">&lt;/img>&lt;/a>&lt;/p>

  • Control stylistic elements of your site that appear on all its pages using your Custom Style Sheet, or CSS, rather than manually applying formatting to text or images within HTML code. In some instances, shortening long HTML code is a matter of eliminating it entirely.

Related Searches


Promoted By Zergnet


Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!