How can i hide div from print?

Hello, please help me. I am a beginner in HTML. I want some blank fields not to be printed (eg div textarea input, etc.). How do I do that? I do not know how to use CSS and JAVASCRIPT, so I only use HTML and maybe you can help me. (Sorry if my English is bad i am from georgia.)

this is code , but i want hide whole div if there is no information …

		<div>			
			<table border="1" width="100%" class="bold_13"> 
			<button type="button"  class="no-print  buttonplus vbc-start-click" repeatable-button="satelofono_konsultacia_dv">+</button>					
			<b> ---------- </b> 
					<tr align="center">
						<td width="15%"> ---- </td>
						<td > pac	 
						</td>
						<td width="30%"> recom</td>
					</tr>
			</table>
			<div class="satelofono_konsultacia_dv  no-print  vbc-elements" style="margin-top: 1em; display: none;"	>
				<table border="1" width="100%" class="bold_13">
					<tr>
						<td width="15%"> <textarea id="satelofono_konsultacia_TariRi_"  autoResize style="overflow:hidden" class="textarea no-save "></textarea> </td>
						<td  width="55%"> <textarea  id="satelofono_konsultacia_pacientis_mdgomareoba_" autoResize style="overflow:hidden" class="textarea no-save "></textarea> </td>
						<td  width="30%"> <textarea id="satelofono_konsultacia_rekomendaciebi_"  autoResize style="overflow:hidden" class="textarea no-save "></textarea> </td>
					</tr>
				</table>
			</div>

	</div>

Just set a print media query and restrict the style, unless I’m missing something obvious

@media print {
.no-print { display: none; }
}
2 Likes

Hi,

Can you clarify the question a little please.

Do you mean you want to hide certain portions of that page when sending to a printer or were you talking about printing to screen?

If you were talking about sending to a printer than you would need CSS media queries for print and just print the items you want which is pretty straight forward assuming you know which items they are beforehand.

However from your question is sounds like you want a logical operation where you don’t want blank fields printed if they haven’t been filled in. That would require javascript to detect the items and indeed would need a JS print button added also because if a user used the browsers print control then the js would never be run.

If you can clarify the problem or confirm the above then progress can be made towards a solution but I believe it will be more complicated than it sounds if you are talking about not printing form elements that have not had content entered.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.