What Is the base Element and When Should You Use It?
Learn how the base element sets the base URL for relative links, how it affects anchors and fetch, and when to avoid it.
74 posts about HTML: questions with answers, tutorials and articles, newest first.
Learn how the base element sets the base URL for relative links, how it affects anchors and fetch, and when to avoid it.
Wrap an image in an anchor to make it clickable, write useful alt text, style focus, and use image maps for several links.
Learn what the rel attribute does on links: noopener, noreferrer, nofollow, sponsored, ugc, and how link also uses it.
Add the download attribute to a link to save a file, set its name, and learn the cross-origin limits and blob downloads.
Use mailto: to open an email draft and tel: to start a call. Learn subject and body encoding, international numbers and spam tips.
Use target="_blank" with rel="noopener noreferrer" to open links in a new tab. Learn the risk it prevents and when new tabs are a good idea.
Give an element an id and link to it with href="#id". Learn smooth scrolling, sticky header offsets, :target styling and skip links.
Learn the web accessibility basics: semantic HTML, text alternatives, labelled forms, keyboard focus, contrast, ARIA and how to test with assistive tools.
Absolute URLs spell out the scheme and host, relative URLs depend on the current page. Learn how each resolves and when to use it.
Learn the a element syntax, what href can point to, how to write accessible link text and how to style links with CSS.
Learn how to save HTML as UTF-8, type Devanagari directly, and use the lang attribute for Hindi and mixed-language pages.
Learn the difference between div and span, when to use each as a generic container, and which semantic elements to prefer instead.
Learn to mark dates, times and durations with the time element, use valid datetime formats and show them in the reader's own locale.
Learn to mark abbreviations in HTML with abbr and title, style them with CSS and make sure the full form is available to every reader.
Learn when to use blockquote for long quotes and q for short ones, how the cite attribute works and how to credit sources and style quotes.
Build HTML forms step by step: the form element, input types, labels, select and textarea controls, and built-in validation with examples.
Learn when to use code, pre, kbd and samp in HTML to show code, shortcuts and program output with correct escaping and CSS styling.
Semantic HTML uses elements that describe what content means. See the key elements and why they help accessibility, search engines and developers.
Use the sub and sup elements to lower or raise text for chemical formulas, exponents and footnote markers, and style them with CSS.
Understand the difference between HTML tags, elements and attributes, how nesting works, and which global attributes every beginner should know.