In HTML, you can use the <mark>
tag to highlight or mark text that you want to bring attention to. This tag is typically displayed with a yellow background by default, making the marked text stand out. The <mark>
tag is often used to highlight search results, important terms, or other notable content.
Here is an example demonstrating the use of the <mark>
tag:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Marked Text in HTML</title>
<style>
/* Custom style for marked text */
mark {
background-color: lightgreen; /* Change the background color */
color: black; /* Change the text color */
}
</style>
</head>
<body>
<p>This is a normal paragraph of text.</p>
<p>This is a paragraph with <mark>marked text</mark> to highlight important information.</p>
<p>Search results for "HTML":
<ul>
<li>The <mark>HTML</mark> language is used to create web pages.</li>
<li>Learning <mark>HTML</mark> is the first step to becoming a web developer.</li>
</ul>
</p>
</body>
</html>
In this example:
<mark>
tag is used to highlight specific text within paragraphs.The <mark>
tag is a simple and effective way to draw attention to specific parts of your text, making it useful for emphasizing important information in various contexts.