What are the limitations of using media="print" in PHP for styling print layouts?
Using media="print" in PHP for styling print layouts has limitations because it only applies to the print media type. This means that the styles specified within media="print" will only be used when the webpage is printed, and not when it is viewed on screen. To solve this issue, you can create a separate CSS file specifically for print styles and include it in your PHP file using the link tag.
<!DOCTYPE html>
<html>
<head>
<title>Print Layout</title>
<link rel="stylesheet" type="text/css" href="print-styles.css" media="print">
<style>
/* Screen styles */
body {
background-color: #f0f0f0;
color: #333;
}
</style>
</head>
<body>
<h1>This is a print layout example</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</body>
</html>