My current code involves working with the CSS print feature. When I implement the following code, a URL is visible next to the KRON4
in two instances:
1) Viewing the page in the browser window 2) Clicking the print button on the browser.
I aim to display the URL only when scenario 2 occurs - clicking the print button on the browser window. To achieve this, I replaced the content of the <style>
tag as shown below with a specific media query
:
<style type="text/css">
@media print body {
a[href^="http://"]:after {
content: " (" attr(href) ")";
color: blue;
font-size: small;
}
}
</style>
Despite implementing the above style content, the URL does not appear as intended during printing.
Below is the provided code snippet without the media query:
<!DOCTYPE html>
<html lang="en>
<head>
<title>Print Media and Mobile Devices</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
a[href^="http://"]:after{
content: " (" attr(href) ")";
color: blue;
font-size: small;
}
</style>
</head>
<body>
<p>
<a href="http://kron4.com/">KRON 4</a>
</p>
</body>
</html>