I have a web page that display this:
The Html behind this is:
<label>Approved For Payment:</label>
<select id="Invoice_ApprovedForPayment" class="dropdownapprovedforpayment" name="Invoice.ApprovedForPayment" lineid="299" disabled="disabled">
<option value="null" selected="selected">Please Approve</option>
<option value="true">Accepted</option>
<option value="false">On Hold</option>
</select>
Currently when this page is printed the Please Approve is coming out like shown. As in it prints it as a select dropdownlist. This makes sense however I was hoping that I could somehow get it so that when it prints it will look like it's a normal label, span etc? I was thinking this may be possible using print.css? Can anybody tell me how to achieve this?
<select> tags can be styled through CSS just like any other HTML element on an HTML page rendered in a browser. Below is an (overly simple) example that will position a select element on the page and render the text of the options in blue.
You can use CSS to change the appearance of your web page when it's printed on a paper. You can specify one font for the screen version and another for the print version. You have seen @media rule in previous chapters. This rule allows you to specify different style for different media.
The @media CSS at-rule can be used to apply part of a style sheet based on the result of one or more media queries. With it, you specify a media query and a block of CSS to apply to the document if and only if the media query matches the device on which the content is being used.
A print stylesheet formats a web page so that, when printed, it automatically prints in a user-friendly format. Here's what you need to know. Print stylesheets have been around for a number of years and have been written about extensively.
Easiest way that I can think to accomplish this would be to create a span that is hidden in screen.css
next to the select list and when you change the value in the select list, update the value of the span. In your print.css
show the span and hide the select element
Javascript
<script type="text/javascript">
$(document).ready(function() {
$("#Invoice_ApprovedForPayment").change(function() {
$("#Invoice_ApprovedForPaymentSpan").val($(this).val());
});
});
</script>
HTML
<select id="Invoice_ApprovedForPayment" class="dropdownapprovedforpayment noprint" name="Invoice.ApprovedForPayment" lineid="299" disabled="disabled">
<option value="null" selected="selected">Please Approve</option>
<option value="true">Accepted</option>
<option value="false">On Hold</option>
</select>
<span id="Invoice_ApprovedForPaymentSpan" class="noscreen"></span>
CSS
print.css
.noprint { display: none; }
.noscreen { display: inline; }
screen.css
.noprint { display: inline; }
.noscreen { display: none; }
Just make sure that the media for your print stylesheet is set to print
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With