Inline HTML elements do not force a line break before or after them. It seems common sense to say it but the content of an inline element flows from left to right. The <a>
anchor tag, just discussed, is an example of an inline element.
Another popular inline element is <b>
or <strong>
. Text can be made bold by using <b>
or <strong>
. The <strong>
tag is considered to be more accessible for individuals using screen readers.
<body> <p> <b>This text is bold</b> </p> <p> <strong>This text is bold</strong> </p> </body>
Text can be made italic by using <i>
or <em>
. The <em>
emphasis tag is considered to be more accessible for individuals using screen readers.
<body> <p> <i>This text is italic</i> </p> <p> <em>This text is italic </em> </p> </body>
Note: both bold and italics can be applied through CSS as we’ll see later.
One of the most commonly used inline elements is <span>
, which we’ll discuss under grouping elements.