|
| 1 | +--- |
| 2 | +title: Inline HTML |
| 3 | +--- |
| 4 | + |
| 5 | +Web pages are written in **HTML** (HyperText Markup Language), which uses tags like `<p>`, `<a>`, and `<strong>` to describe how things should look. |
| 6 | + |
| 7 | +In a Markdown document, you can sometimes mix in small pieces of HTML. |
| 8 | +This is called **inline HTML**: you add a tiny HTML tag inside a sentence, and Quarto keeps it when it turns your page into HTML. |
| 9 | + |
| 10 | +**Caveat:** raw HTML is only kept when the output format supports it (for example, HTML pages). Some tags may be dropped or ignored when rendering to PDF or Word. |
| 11 | + |
| 12 | +## Line break |
| 13 | + |
| 14 | +You can insert a line break using `<br>`. |
| 15 | + |
| 16 | +```markdown |
| 17 | +First part of the sentence.<br>Second part on a new line. |
| 18 | +``` |
| 19 | + |
| 20 | +::: {.pale-blue} |
| 21 | + |
| 22 | +**Task:** In `html.qmd`: |
| 23 | + |
| 24 | +* [ ] Write a short sentence, then use `<br>` to put a second short sentence on the next line with a line break between them. |
| 25 | + |
| 26 | +::: |
| 27 | + |
| 28 | +## Small text |
| 29 | + |
| 30 | +You can make a small "fine print" style note using the `<small>` tag. |
| 31 | + |
| 32 | +```markdown |
| 33 | +This is <small>small print</small>. |
| 34 | +``` |
| 35 | + |
| 36 | +This is <small>small print</small>. |
| 37 | + |
| 38 | +::: {.pale-blue} |
| 39 | + |
| 40 | +**Task:** In `html.qmd`: |
| 41 | + |
| 42 | +* [ ] Add a normal sentence and then make one short phrase look like small print using `<small> ... </small>`. |
| 43 | + |
| 44 | +::: |
| 45 | + |
| 46 | +## Keyboard keys |
| 47 | + |
| 48 | +The `<kbd>` tag is often used to show keys that the user should press on the keyboard. |
| 49 | + |
| 50 | +```markdown |
| 51 | +Press <kbd>Ctrl</kbd> + <kbd>C</kbd>. |
| 52 | +``` |
| 53 | + |
| 54 | +Press <kbd>Ctrl</kbd> + <kbd>C</kbd>. |
| 55 | + |
| 56 | +::: {.pale-blue} |
| 57 | + |
| 58 | +**Task:** In `html.qmd`: |
| 59 | + |
| 60 | +* [ ] Write one instruction that shows a keyboard shortcut using `<kbd>` (for example, `Ctrl + S` to save). |
| 61 | + |
| 62 | +::: |
| 63 | + |
| 64 | +## Custom links |
| 65 | + |
| 66 | +If you want more control over a link (for example, to open it in a new tab), you can write it in HTML instead of plain Markdown. |
| 67 | + |
| 68 | +In the HTML link below: |
| 69 | + |
| 70 | +* `href` is the web address you are linking to. |
| 71 | +* The text between `<a>` and `</a>` is what the reader clicks on. |
| 72 | +* `target="_blank"` tells the browser to open the link in a new tab. |
| 73 | +* `rel="noopener"` is a small security and performance setting that stops the new page from being able to control the original tab. |
| 74 | + |
| 75 | +```markdown |
| 76 | +<a href="https://www.exeter.ac.uk" target="_blank" rel="noopener"> |
| 77 | + Visit the University of Exeter website |
| 78 | +</a> |
| 79 | +``` |
| 80 | + |
| 81 | +<a href="https://www.exeter.ac.uk" target="_blank" rel="noopener"> |
| 82 | + Visit the University of Exeter website |
| 83 | +</a> |
| 84 | + |
| 85 | +::: {.pale-blue} |
| 86 | + |
| 87 | +**Task:** In `html.qmd`: |
| 88 | + |
| 89 | +* [ ] Create a link that opens in a new tab by default. |
| 90 | + |
| 91 | +::: |
| 92 | + |
| 93 | +## Abbreviations |
| 94 | + |
| 95 | +You can explain abbreviations by using the `<abbr>` tag with a `title` attribute. |
| 96 | +When someone hovers over it in a browser, they see the full phrase. |
| 97 | + |
| 98 | +```markdown |
| 99 | +<abbr title="Randomised Controlled Trial">RCT</abbr> |
| 100 | +``` |
| 101 | + |
| 102 | +<abbr title="Randomised Controlled Trial">RCT</abbr> |
| 103 | + |
| 104 | +Alternatively, you can use footnotes @sec-footnotes to explain the term. |
| 105 | + |
| 106 | +::: {.pale-blue} |
| 107 | + |
| 108 | +**Task:** In `html.qmd`: |
| 109 | + |
| 110 | +* [ ] Pick one abbreviation you use in your own work (for example, "NHS" or "A&E") and write it with an `<abbr>` tag and a helpful title. |
| 111 | + |
| 112 | +::: |
0 commit comments