Why should HTML formatting like the align attribute be avoided in the <head> section and replaced with CSS?
Using HTML formatting like the align attribute in the <head> section is not recommended because the <head> section is meant for metadata and linking external resources, not for styling content. It is best practice to separate content and styling by using CSS for all formatting. To solve this issue, simply move the styling to a separate CSS file and link it in the <head> section using the <link> tag. ```html <!DOCTYPE html> <html> <head> <title>Example Page</title> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body> <h1 class="centered">Welcome to Example Page</h1> <p>This is an example paragraph.</p> </body> </html> ``` styles.css: ```css .centered { text-align: center; } ```
Keywords
Related Questions
- How can you effectively handle errors in MySQL queries in PHP using mysql_error()?
- What are the common pitfalls when trying to isolate and display the latest date from a database table in PHP?
- What are the best practices for installing and enabling PHP modules in a situation where the required modules are no longer available in repositories?