` (horizontal rule) tag. It specifies that the horizontal line should render as a solid, flat color instead of the default 3D shaded line. --- ## Quick Example By default, many older browsers render the `
` element with a dual-tone, 3D-shaded bevel effect. Applying the `noshade` attribute removes this shading, rendering a flat, solid-colored line. ```html
A standard horizontal line (default, may have shading):
A horizontal line without shading:
``` --- ## Definition and Usage * **Purpose:** Specifies that the horizontal rule should be rendered in a solid, single color without 3D shading or bevel effects. * **Type:** Boolean attribute. Its presence alone triggers the effect (e.g., `
`). * **Status:** **Deprecated** in HTML 4.01 and **Not Supported** in HTML5. Modern web standards require using CSS to style horizontal rules. --- ## Syntax ### HTML (Standard) ```html
``` ### XHTML (Strict) In XHTML, attribute minimization is forbidden. The `noshade` attribute must be explicitly defined with its value: ```html
``` --- ## Browser Support All major desktop and mobile browsers historically support the `noshade` attribute: * Google Chrome * Mozilla Firefox * Microsoft Edge / Internet Explorer * Safari * Opera *Note: While browsers still support this attribute for backwards compatibility, it should not be used in modern web development.* --- ## Modern CSS Alternatives (Recommended) Because the `noshade` attribute is deprecated, you should use CSS to achieve flat, solid-colored lines. This ensures your code is HTML5-compliant and renders consistently across all modern browsers. ### Cross-Browser CSS Solution To create a flat, solid 2px gray line across all browsers, use the following CSS: ```html
``` ### Why use both `color` and `background-color`? Different legacy browsers handle the coloring of `
` differently: * **Internet Explorer / Edge (Legacy):** Uses the `color` property to style the line. * **Firefox, Chrome, Safari, and Opera:** Use the `background-color` and `border` properties to style the line. By setting `border-width: 0` (or `border: none`) and defining both `color` and `background-color`, you guarantee a consistent, flat, solid-colored line across all platforms. ### External CSS Class Example (Best Practice) Instead of inline styles, define a class in your stylesheet: ```css /* CSS */ .flat-line { height: 2px; border: none; color: #333333; /* For older IE */ background-color: #333333; /* For modern browsers */ } ``` ```html
Modern flat horizontal rule styled with CSS:
```
YouTip