HTML Elements: The Tricky Parts

June 19, 2018
HTML <iframe> <a> <form> <input> <table>

HTML src attribute

The src attribute can be applied to many elements like <iframe>, <img>, <input>, etc. It can be used to specify the content of the frame with either absolute or relative URL. A URL that starts with the URL scheme and scheme specific part ( http:// , https:// , ftp:// , etc.) is an absolute URL, and the location of the resource can be resolved looking only at the url itself. A relative URL is in a sense incomplete: to resolve it, you need the scheme and hostname, and these are typically taken from the current context.

In general, it is considered best-practice to use relative URLs, so that your website will not be bound to the base URL of where it is currently deployed. Always use relative URLs (for local resources)!! Further reading here.

<iframe>

<a>

<form>

<input>

<select>

Represents a control that provides a menu of options (another way of making choices).

See the following example code and pay attention to the attributes of <option>: selected, disabled. We can also make multiple choices by adding the boolean multiple attribute to <select>, and hold the Ctrl, Command, or Shift keys while clicking to select or deselect multiple options.

JS Bin on jsbin.com

<textarea>

JS Bin on jsbin.com

<table>

It is used for displaying tabular data. You can think of it as a way to describe and display data that would make sense in spreadsheet software. Essentially: columns and rows.

comments powered by Disqus