Insert a white dividing line below the text in a textarea

Is there a way to add line breaks in a textarea without the user having to press "Enter", so that these empty lines will be visible when printing?

<html >
<head>

<!-- script print button -->
 <script type="text/javascript">
      function printTextArea() {

        childWindow = window.open('','childWindow','location=yes, menubar=yes, toolbar=yes');
        childWindow.document.open();
        childWindow.document.write('<html><head></head><body dir="rtl">');
        childWindow.document.write(document.getElementById('targetTextArea').value.replace(/\n/gi,'<br/>'));
        childWindow.document.write('</body></html>');
        childWindow.print();
        childWindow.document.close();
        childWindow.close();
      }
    </script>
<style type="text/css">

textarea {
direction: rtl; 
 background-color: white;
 font-size: 1em;
 font-weight: bold;
 font-family: Verdana, Arial, Helvetica, sans-serif;
 border: 1px solid #00acee;
 resize: none;
}

</style>
</head>

<body>
  <p>
    <TEXTAREA name="thetext" rows="20" cols="80"id="targetTextArea" placeholder="Copy and paste your text here to fill it out, edit it, and then print using the button below ......">
</TEXTAREA>
   </p>
   <!-- print button -->
  <center> <input type="button" onclick="printTextArea()" value="Print"/></center>
</body>
</html>

Answer №1

This method should work well. In case the padding appears off, consider incorporating a margin instead.

@media print {
   textarea {padding-bottom:2cm;}
}

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

A step-by-step guide to creating an interactive Rubik's Cube using THREE JS and loading custom images onto each individual

I am facing a challenge with developing a 5x5 Rubik's Cube. The cube has six faces, which means I need to display 25 images on each small box of each face, totaling 150 images for the entire 5x5 cube. Although the Rubik's Cube itself is displayed ...

Creating a JavaScript AJAX POST function and processing it with Ruby on Rails 3.0

I have a simple task that I am struggling with. What I want to achieve is when a button on my HTML JavaScript page is clicked, it sends a large amount of data to the server using the AJAX POST method. The server then uses this data to create an XML file, w ...

Clicking on an Angular routerLink that points to the current route does not function unless the page is re

Currently, I am working on an E-commerce project. In the shop page, when a user clicks on the "View More" button for a product, I redirect them to the product details page with the specific product id. <a [routerLink]="['/product-details' ...

The JQuery UI datepicker is constantly popping open

On my website, I have implemented a JQuery UI date and time picker in a form. Users can select the date, time, and provide additional information. However, whenever the user clicks on the text input for additional information, the date and time picker pop- ...

Achieve a bottom alignment in Bootstrap without using columns

I am looking to align the elements within a div to the end, but when I use Bootstrap's d-flex and align-items-end classes, it causes the elements to be split into columns. This is not the desired outcome. How can I resolve this issue? <link href ...

Tips for effective page management

After creating a navbar in my project, I've come to the realization that it requires a component for each page and subpage. This seems redundant especially when dealing with multiple navigation options like shown in this image. Is it necessary to crea ...

Minimizing conditional statements in my JavaScript code

I've just completed the development of a slider and am currently working on optimizing some repetitive if/else statements in the code. The purpose of these conditions is to determine whether the slider has reached the last slide, in which case the nex ...

The correct functioning of CSS hyperlinks is currently experiencing issues

The links in the "request" division are not displaying properly. The style.css file contains the following code for the links in this division: .header .request a span{border-bottom:1px dotted}.header .request a:hover span{border-bottom:0} Example: berdy ...

Executing a class function within the ajax success method

I am attempting to set a variable inside the success callback of an AJAX call. I understand that in order to assign the value, I need to use a callback function. However, I want that function to be within the class. Is it feasible to implement something li ...

Is there a way to incorporate a trace in Plotly while also arranging each data point along the x-axis in a unique custom order?

I am facing a challenge in creating a line graph that displays (x, y) coordinates where the x axis represents a date and the y axis represents a value. The dates are formatted like DD-MM-YYYY, for example, 15-04-2015. My initial trace is added with the fo ...

What is the Best Way to Ask Users Not to Delete Local Storage Information?

As I work on developing an application using angularJS, the need to save data locally has arisen. To achieve this, I am utilizing HTML5 local storage. One challenge faced with HTML5 local storage is that when a user clears their browsing data, all stored ...

Looking for a categorized list of unique special characters and their classifications

I am currently developing a web application focused on providing machine translation support. This involves taking source text for translation and converting it into the user's desired language. At the moment, the application is in the unit testing p ...

Unable to achieve text centering within a button using HTML and CSS

I'm diving into the world of HTML/CSS for the first time and encountering some issues along the way. In my setup.html, I created a "Continue" button and applied a class to style it in styles.css. However, I'm facing an issue where text-align cen ...

The AJAX function is failing to deliver the expected results

Having some trouble calling a PHP method from JavaScript to query a database and use the results in my JS functionality. Currently, the console.log(output) in my ajax call is only displaying: string '{"action":"getResults"}' (length=23) I&apo ...

:last-child is effective, but :first-child is inefficient

I'm having trouble using CSS to hide the first .sku element within an aside that contains two of these elements. Strangely, the :last-child selector works just fine. Can anyone explain why this might be happening? Here's a link to the JSFiddle fo ...

Placement Mismatch of Radio Button in Form.Check Component of React-Bootstrap

Recently, I've been working on implementing a payment method feature where users can choose their preferred payment option using radio buttons. However, there seems to be an issue with the alignment of the button. Below is the code snippet I have so ...

Ways to adjust the size or customize the appearance of a particular text in an option

I needed to adjust the font size of specific text within an option tag in my code snippet below. <select> <?php foreach($dataholder as $key=>$value): ?> <option value='<?php echo $value; ?>' ><?php echo ...

Tips on updating CSS styles for navigation bar links in real time

Currently, my homepage displays a CSS content hover effect when the user interacts with the icons. However, I am facing an issue where all icons show the same text "home" on hover. How can I customize the text output for each individual icon/link? Your hel ...

When an element is transferred to a different <div>, it does not automatically inherit its new CSS styles

There's an element with existing behavior that needs to be moved to meet new requirements without losing its original styles. The challenge is applying new styles to the element after it's been moved. For example: <div id="existingStructure" ...

Sending information from a parent component to a child component in Vue.js and then showcasing the data

Hey there! I'm new to vue.js and I'm struggling to figure out why my data is not being passed to the child component. I've tried a few different approaches, but none seem to be working as expected. It feels like I'm really close, but so ...