Forum Discussion
Nandhakumar_S
22 hours agoCommunity Member
The window.print() method is not working in the Rise code block.
I used a code block in the Rise course to print the page, but Rise does not allow the page to be printed.
Before integrating it into Rise, I tested the code in Visual Studio Code, and it worked well.
Here’s the code for your reference.
Thank you for your assistance.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Simple Print Page</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f8f9fa;
padding: 40px;
text-align: center;
}
#content {
background: #ffffff;
padding: 20px;
border-radius: 10px;
max-width: 600px;
margin: 20px auto;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
text-align: left;
}
button {
background-color: #57A9F5;
color: #000;
font-weight: bold;
border: none;
padding: 12px 30px;
border-radius: 30px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s;
}
button:hover {
background-color: #3b93e0;
}
/* Hide the print button when printing */
MeDia print {
button {
display: none;
}
body {
background: none;
}
}
</style>
</head>
<body>
<h2>Print Page Example</h2>
<div id="content">
<h3>Printable Section</h3>
<p>This is the content you can print using the button below.</p>
<p>You can add text, images, tables, or any HTML elements here.</p>
</div>
<button onclick="printContent()">🖨️ Print This Page</button>
<script>
function printContent() {
window.print();
}
</script>
</body>
</html>
No RepliesBe the first to reply
Related Content
- 8 months ago
- 11 months ago
- 8 months ago
- 9 months ago