Introduction to <dfn>tag

The <dfn>tag in HTML, short for "definition," is used to highlight a term that is being defined within the content. This tag is particularly useful in educational or technical documents where specific terminology needs to be introduced and clarified for the reader.

Copy to clipboard
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>title of <dfn> tag</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
  <h1>Web Development Glossary</h1>
  <p>Explore definitions of key terms used in web development.</p>

  <dl class="glossary-list">
      <dt><dfn>HTML</dfn></dt>
      <dd><dfn>HTML</dfn> (HyperText Markup Language) is the standard language used to create documents on the World Wide Web.</dd>

      <dt><dfn>CSS</dfn></dt>
      <dd><dfn>CSS</dfn> (Cascading Style Sheets) is a stylesheet language used to describe the presentation of a document written in HTML or XML.</dd>

      <dt><dfn>JavaScript</dfn></dt>
      <dd><dfn>JavaScript</dfn> is a programming language commonly used in web development to create interactive effects within web browsers.</dd>

      <dt><dfn>Responsive Design</dfn></dt>
      <dd><dfn>Responsive Design</dfn> is an approach to web design that makes web pages render well on a variety of devices and window or screen sizes.</dd>

      <dt><dfn>API</dfn></dt>
      <dd>An <dfn>API</dfn> (Application Programming Interface) is a set of rules that allows different software entities to communicate with each other.</dd>
  </dl>
</div>
</body>
</html>
Copy to clipboard
/* General Styles */
    body {
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        background-color: #f0f4f8; /* Light blue-gray background */
        color: #333;
        margin: 0;
        padding: 20px;
        display: flex;
        justify-content: center; /* Center content horizontally */
        align-items: center; /* Center content vertically */
        min-height: 100vh; /* Full viewport height */
    }
    
    .container {
        max-width: 700px; /* Set max width for the container */
        width: 100%; /* Full width */
        background-color: #fff; /* White background for the container */
        padding: 40px; /* More padding for a modern look */
        border-radius: 15px; /* Rounded corners for a modern look */
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); /* Deep shadow for depth */
        position: relative;
        overflow: hidden; /* Prevent content overflow */
        transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out; /* Smooth transition for hover effects */
    }
    
    /* Hover effect for container */
    .container:hover {
        transform: translateY(-10px); /* Lift container slightly on hover */
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15); /* Enhance shadow on hover */
    }
    
    h1 {
        text-align: center; /* Center the heading */
        color: #333; /* Dark color for the heading */
        margin-bottom: 25px; /* Margin below the heading */
        font-size: 2.5em; /* Larger font size for the heading */
        font-weight: 700;
        position: relative;
    }
    
    h1::after {
        content: ''; /* Decorative underline effect */
        display: block;
        width: 50px; /* Width of the line */
        height: 5px; /* Height of the line */
        background: #ff6347; /* Tomato color for the line */
        margin: 8px auto 0; /* Center the line */
        border-radius: 3px; /* Rounded ends for the line */
    }
    
    /* Glossary List Styles */
    .glossary-list {
        margin: 0; /* Remove default margin */
        padding: 0; /* Remove default padding */
        list-style-type: none; /* Remove default list styling */
    }
    
    .glossary-list dt {
        font-weight: bold; /* Bold font for terms */
        margin-top: 20px; /* Space above each term */
        color: #0056b3; /* Blue color for terms */
        font-size: 1.2em; /* Slightly larger font size for terms */
        position: relative; /* Position for decorative icon */
        padding-left: 30px; /* Padding to make space for the icon */
        transition: color 0.3s ease; /* Smooth transition for color change */
    }
    
    .glossary-list dt::before {
        content: '💡'; /* Light bulb emoji as decorative icon */
        position: absolute;
        left: 0; /* Align to the left */
        top: 0;
        font-size: 1.1em; /* Adjust size for alignment */
        color: #ff6347; /* Tomato color for the icon */
    }
    
    .glossary-list dd {
        margin-left: 30px; /* Indent descriptions */
        margin-bottom: 15px; /* Space below each description */
        color: #555; /* Dark gray color for descriptions */
        line-height: 1.8; /* Increase line height for readability */
        background-color: #f7f9fc; /* Very light blue-gray background for descriptions */
        padding: 15px 20px; /* Padding inside each description */
        border-left: 5px solid #ff6347; /* Tomato left border for emphasis */
        border-radius: 10px; /* Rounded corners for descriptions */
        position: relative;
        transition: background-color 0.3s ease, border-left-color 0.3s ease; /* Smooth transition for background and border color */
    }
    
    /* Hover effect for definitions */
    .glossary-list dd:hover {
        background-color: #e0f3ff; /* Light blue background on hover */
        border-left-color: #007bff; /* Blue border on hover */
    }
    
    /* Styles for Defined Terms */
    dfn {
        font-style: italic; /* Italic font style for definitions */
        color: #ff6347; /* Tomato color to highlight defined terms */
        border-bottom: 1px dotted #ff6347; /* Dotted underline for emphasis */
        cursor: help; /* Cursor change on hover */
        transition: color 0.3s ease; /* Smooth transition for color change */
    }
    
    dfn:hover {
        color: #333; /* Change color on hover */
        border-bottom-color: #333; /* Change underline color on hover */
    }
    
    /* Responsive Design */
    @media (max-width: 600px) {
        .container {
            padding: 20px; /* Adjust padding for smaller screens */
        }
    
        .glossary-list dt {
            font-size: 1.1em; /* Adjust term font size */
        }
    
        .glossary-list dd {
            font-size: 1em; /* Adjust description font size */
        }
    }

Global Attributes

AttributesDescription
accesskeySpecifies a shortcut key to activate or focus an element.
autocapitalizeControls whether and how text input is automatically capitalized.
classSpecifies one or more class names for the element, allowing CSS styling and JavaScript manipulation.
contenteditableSpecifies whether the content of an element is editable or not.
contextmenuSpecifies a context menu for the element.
dirDefines the text direction. Possible values are "ltr" (left-to-right), "rtl" (right-to-left), and "auto".
draggableSpecifies whether an element is draggable. Possible values are "true" or "false".
enterkeyhintSpecifies the action label or icon to be shown for the enter key on virtual keyboards.
hiddenIndicates that the element is not yet, or is no longer, relevant. The browser does not display elements that have the `hidden` attribute set.
idSpecifies a unique identifier for the element.
inputmodeProvides a hint to browsers for which virtual keyboard configuration to use when editing this element or its descendants.
isAllows you to specify the type of custom element.
langSpecifies the language of the element's content.
nonceA cryptographic nonce ("number used once") that can be used by Content Security Policy (CSP) to determine whether or not a given fetch will be allowed to proceed.
partSpecifies the element’s part in the shadow DOM.
slotAssigns a slot in a shadow DOM shadow tree.
spellcheckIndicates whether the element is subject to spell checking.
styleProvides inline CSS styling for the element.
tabindexSpecifies the tab order of the element.
titleAdds extra information about the element, displayed as a tooltip when hovering over the element.
translateSpecifies whether the content of the element should be translated. Possible values are "yes" or "no".
HTML AttributesGlobal AttributesEvent Attributes
To view the full list
To view the full list
To view the full list
elementsChrome BrowsersMicrosoft Edge BrowserFirefox BrowsersSafari BrowserOpera Browser
<dfn>YesYesYesYesYes