HTML <colgroup> width Attribute

Example A <colgroup> element that specifies that the first column should have a predefined width of 200 pixels: <table> <colgroup width=”200″> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </table> Try it Yourself » Definition and Usage The width attribute specifies the width of a column group. Normally, a column group takes […]

HTML <col> width Attribute

Example Two <col> elements with a predefined width: <table> <col width=”130″> <col width=”80″> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </table> Try it Yourself » Definition and Usage The width attribute specifies the width of a <col> element. Normally, a <col> element takes up the space it needs to display the content. […]

HTML <code> Tag

Example Format text in a document: <code>A piece of computer code</code> Try it Yourself » Definition and Usage The <code> tag is a phrase tag. It defines a piece of computer code. Tip: This tag is not deprecated, but it is possible to achieve richer effect with CSS. All phrase tags: Tag Description <em> Renders as […]

HTML <cite> Tag

Example Define the title of a work with the <cite> tag: <p><cite>The Scream</cite> by Edward Munch. Painted in 1893.</p> Try it Yourself » Definition and Usage The <cite> tag defines the title of a work (e.g. a book, a song, a movie, a TV show, a painting, a sculpture, etc.). Note: A person’s name is not the […]

HTML DOM Abbreviation Object

Abbreviation Object The Abbreviation object represents an HTML <abbr> element. Access an Abbreviation Object You can access an <abbr> element by using getElementById(): Example var x = document.getElementById(“myAbbr”); Try it Yourself » Create an Abbreviation Object You can create an <abbr> element by using the document.createElement() method: Example var x = document.createElement(“ABBR”); Try it Yourself » Standard […]

HTML Computer Code Elements

Computer Code <code> x = 5;<br> y = 6;<br> z = x + y; </code> Try it Yourself » HTML <kbd> For Keyboard Input The HTML <kbd> element represents user input, like keyboard input or voice commands. Text surrounded by <kbd> tags is typically displayed in the browser’s default monospace font: Example <p>Save the document by pressing <kbd>Ctrl + S</kbd></p> […]

HTML Paragraphs

The HTML <p> element defines a paragraph: Example <p>This is a paragraph.</p> <p>This is another paragraph.</p> Try it Yourself » Note: Browsers automatically add some white space (a margin) before and after a paragraph. HTML Display You cannot be sure how HTML will be displayed. Large or small screens, and resized windows will create different results. With HTML, you […]

HTML Elements

An HTML element usually consists of a start tag and end tag, with the content inserted in between: <tagname>Content goes here…</tagname> The HTML element is everything from the start tag to the end tag: <p>My first paragraph.</p> Start tag Element content End tag <h1> My First Heading </h1> <p> My first paragraph. </p> <br> HTML elements with no content are called […]