The appearance of a printed webpage is strikingly distinct from its digital counterpart

Currently, I am working on setting up online invitations and one of the options for sending them out is through print. However, despite having the invitations perfectly designed on the web page, the outcome after printing is not what I expected. You can view a sample set of invitations here. The invitations are arranged in a 2x2 grid format with text overlaid using HTML at specific percentages from the top and left of the images. Unfortunately, there are three main issues that arise when attempting to print:

  1. The text color appears different during printing, always turning out black regardless of the specified CSS color.
  2. Text overflows from the image, even though there should be JavaScript adjusting the text size to fit within the image boundaries.
  3. The invitations do not display on a 2x2 grid format as intended.

Some important details about the CSS setup: all styling rules are applied within an @media all block and there is an extra @page {size: landscape} block included to ensure the page prints in landscape mode as suggested in this resource. Bootstrap framework is being utilized; however, it can be removed if necessary. Both the HTML and body tags are set to a height and width of 100%.

Answer №1

For those who are printing directly from their browser, it's important to consider a print stylesheet. CSS for the Web and CSS for print have significant distinctions.

I came across a helpful SmashingMagazine link that explains the variances and provides guidance on creating a Style sheet specifically for printing:

Note that custom javascript adjustments for text-size may not work during printing, so ensure to incorporate those modifications into your print stylesheet as well.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issue with Nav Bar Toggle not changing text to white color

Query I'm baffled as to why the text in the navigation bar (when opened with the Burger Menu) refuses to turn white. I've exhausted all efforts to change the color to white. Please assist me in pinpointing why the text remains unaffected when t ...

A step-by-step guide on utilizing jQuery to cyclically change the background color of elements upon clicking, and resetting the colors upon clicking another element

So I've been working on a solution to change the background color for accessibility purposes on a client's website. To achieve this, I have a set of div elements with different background colors and I'm using jQuery to update the body backgr ...

Different methods for modifying the height of an Angular datatable in response to the data provided

Encountering an issue with adjusting the height of a datatable when calling a webservice to populate it. A webpage features a collapsible div element alongside a datatable. Upon collapsing the div, the table's height is calculated and resized using i ...

Arranging Text and Images in HTML/CSS to Ensure Optimal Placement When the Window Size Changes

Hello fellow coders! I've recently started diving into the world of website development and I have a query regarding positioning elements and handling window resizing. Can anyone help me out? I'm trying to center an image, a message, and a passw ...

Creating dynamic web content using KaTeX and Node.js

When I attempt to display a complex formula using HTML and CSS, I encounter difficulties. Instead of the desired output, my screen is filled with confusing unicode characters. To resolve this issue, I decided to use KaTeX. I downloaded KaTeX into the dire ...

Footer positioned centrally on screen

My webpage footer seems to be misplaced, appearing in the middle of my content instead of at the bottom where it should be. Surprisingly, the code for the footer works perfectly on other pages. Any suggestions on why this might be happening? I've sco ...

Tips for centering a flexbox on a webpage:

<template> <div> <div class="flex justify-center w-full"> <div class="h-px-500 md:w-1/6 bg-orange-200 text-center">1</div> <div class="h-px-500 md:w-1/6 bg-orange-300 text-center">2</div> <div clas ...

CSS media queries fail to accurately detect the screen size of the device

I am currently developing a mobile web application and have implemented a media query to specifically target phones with a screen height lower than that of the iPhone X+ (812px): @media (max-height: 811px) { } While this media query works flawlessly on ...

"Encountering a 404 error while attempting to forward to an HTML

I've been encountering an issue while trying to transition from a JSX page to an HTML page. Every time I attempt to do so, I receive a 404 error stating that the page doesn't exist. It's puzzling because it is clearly present in my files and ...

Filtering content with a sliding effect using CSS and JavaScript

I'm currently developing a jQuery mobile app that requires filtering posts on a specific page. I have already added the posts and designed the filter. Take a look at how it appears below: https://i.sstatic.net/mVh9X.png I am working on animating th ...

The imported font used in Firefox is displaying with a striking underline text-decoration

I am currently using the Cardiff font in a project and attempting to apply the style text-decoration:underline to it. While this works perfectly in Chrome (Version 35.0.1916.114), in Firefox (Version. 29.0.1) the underline appears to be crossing through t ...

Place the select option within the input field

input { width: 100%; } .input-currency:after { position: absolute; right: 0; top: 10px; content: 'USD'; border-left: 1px solid black; padding: 0 7px; padding-right: 4em; } <div class="input-currency"> <input id="value" ...

Tips for creating a fixed element with ScrollTrigger and GSAP

How can I prevent the right div from jumping on top of the left div when using a scroll trigger to make the left div's position fixed? gsap.registerPlugin(ScrollTrigger); const tlfour = gsap.timeline({ scrollTrigger: { trigger: ".ma ...

When the user saves the changes on the pop-up window, the main window will automatically refresh

I currently have a calendar feature that allows users to create, edit, and delete appointments. When a user clicks on the new appointment button, it opens a window above the calendar interface. Once the user fills out the necessary fields and clicks save, ...

Automate the manipulation of a dynamically-generated table using Selenium and javascript

Is it feasible to use Selenium to select a menu item created primarily with JavaScript? The HTML tags for this table are only visible in the view source. <table id = "table_id"> <tr> <td> <script> *** </script> </ ...

Customizing CSS in Blazor on mouseover with multiple displayed divs

@foreach (var item in RootOfJson.results) { <div class="card" @onmouseout="@OnMouseOut" @onmouseover="@OnMouseOver"> <img class="@Imgdisplay" <a href="/cdn-cgi/l/email-protection" class="__cf_email__" da ...

Tips for preventing vertical spaces between table header cells in material-UI

Is there a way to remove the vertical gaps between header cells in the MUI table? To see an example of the issue, check out this codesandbox link: https://codesandbox.io/s/mui-material-table-sticky-header-forked-euilo3?file=/tsconfig.json I have attempte ...

Guide to selecting a checkbox using its unique identifier with a specific key press

Does anyone know how to create a script that will automatically click a checkbox when the 'c' key is pressed? I would appreciate any guidance or assistance in creating this script. This is the desired functionality: $("#cHideChat").click(); ...

`A problem with HTML element display in Internet Explorer versions 8 and 9 involving <p> and <h2> tags`

While working on my website, I encountered an issue with the way text is being rendered in <p> and <h2>. The footer of my site has three columns, but for some reason the middle column is displaying its <p> text within the <h2> text ...

How can I sort child divs based on a data attribute containing recent date time using jQuery?

Organizing sections by their respective category names and reordering child div elements based on the data attribute, sorted in descending order from most recent to oldest published date. However, encountering issues with the function reArrangeVideosByRece ...