Input additional content within the HTML texarea box

Can lines be added to an HTML textarea for a notebook paper-like effect? I'm thinking something similar to this:






Answer №1

Here is a method you can use:

HTML:

<textarea class="paperlines"></textarea>

CSS:

.paperlines
{
    background-image: -webkit-linear-gradient(left, white 10px, transparent 10px), -webkit-linear-gradient(right, white 10px, transparent 10px), -webkit-linear-gradient(white 30px, #ccc 30px, #ccc 31px, white 31px);
    background-image: -moz-linear-gradient(left, white 10px, transparent 10px), -moz-linear-gradient(right, white 10px, transparent 10px), -moz-linear-gradient(white 30px, #ccc 30px, #ccc 31px, white 31px);
    background-image: -ms-linear-gradient(left, white 10px, transparent 10px), -ms-linear-gradient(right, white 10px, transparent 10px), -ms-linear-gradient(white 30px, #ccc 30px, #ccc 31px, white 31px);
    background-image: -o-linear-gradient(left, white 10px, transparent 10px), -o-linear-gradient(right, white 10px, transparent 10px), -o-linear-gradient(white 30px, #ccc 30px, #ccc 31px, white 31px);
    background-image: linear-gradient(left, white 10px, transparent 10px), linear-gradient(right, white 10px, transparent 10px), linear-gradient(white 30px, #ccc 30px, #ccc 31px, white 31px);
    background-size: 100% 100%, 100% 100%, 100% 31px;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
    line-height: 31px;
    font-family: Arial, Helvetica, Sans-serif;
    padding: 8px;
    width:300px;
    height:500px;
}
.paperlines:focus
{
    outline: none;
}

Jsfiddle example: http://jsfiddle.net/jagmitg/7kteksez/


UPDATE: included another method for improved scrolling

Add the following to the paperlines class

http://jsfiddle.net/jagmitg/7kteksez/1/

background-attachment: local;

Answer №2

Design a simple single-line image using basic graphic tools and set it as the background for a text area.

Include the following CSS code:

textarea {
 background: url('image path') repeat-y;
}

Remember to adjust the height of the image based on the font size you plan to use in the text area.

I trust this information proves useful.

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

How can you create two HTML DIVs side by side with equal heights?

I am working on creating two side by side DIVs, where one contains static content and the other has dynamic content. My goal is to make sure that the height of the static DIV increases whenever the height of the dynamic DIV increases. Here's the code ...

Stop the automatic display of the dropdown menu

How can I prevent the dropdown menu from automatically showing when I remove the 'hidden' class in jQuery: Sample HTML: <div class="btn-group btn-group-xs friend-request tooltiped" data-toggle="tooltip" title="Add as friend"> <button ...

Using jQuery to slide elements across the page

I've been attempting to incorporate a sliding effect into my website, but I'm running into an issue where the sliding only occurs on the first click and I can't figure out why. Here is the code snippet I've been using: Html : $("#go ...

When using JQuery's :first selector, it actually chooses the second element instead of the first

I'm facing an issue with a JQuery script that makes an AJAX request to the following URL https://djjohal.video/video/671/index.html#gsc.tab=0, which holds information about a video song. My goal is to extract and retrieve all the details from the HTM ...

Adjust the column width in Bootstrap to maximize the space it occupies

One issue I'm currently facing is: Here is the corresponding html code snippet: <div class="row"> <div ng-cloak class="col-md-7 col-sm-6 col-xs-12"> <form class="form"> <input type="text" class="form-cont ...

Can an image be positioned so that it extends beyond the edge of the window without impacting the scroll bars?

I'm trying to position an image on the side of the screen that only shows up on large widescreen monitors. Currently, I have this tag in place which positions it perfectly: <img src="image.png" style="position: absolute; left: 1400px ...

Error encountered during Bootstrap 4 SCSS compilation: Invalid US-ASCII character identified as "xE2"

Encountering difficulties when compiling certain bootstrap 4 modules (switching from beta3). Despite the fact that the issue can be resolved by adding @charset: 'UTF-8'; to the _hover.scss mixin partial (which is flagged as deprecated within the ...

Set the default value in the second dropdown menu according to the choice made in the first dropdown menu

Hey there! I'm trying to dynamically load information based on the default value in the first dropdown hikashop_product_characteristic_1. Depending on the default value selected in this dropdown, I want to show/hide specific options in the second drop ...

Tips for effectively utilizing the Material-UI Grid component to implement this layout

Currently, I am working on incorporating this design in Material-UI by utilizing the Grid component. To better delineate the boundaries, I have marked the container border in red for clarity. The Add button should be positioned at the far right of the c ...

Execution of Ajax call fails to occur synchronously

I have created a unique weather website that utilizes the flickr API as well as the yahoo API to gather weather data. However, I am facing an issue where the ajax call from the yahoo API does not retrieve the necessary data in time for the content of the p ...

Having trouble determining the dimensions of a newly added element

I am using jQuery to dynamically add an image but I am unable to retrieve its dimensions (width and height). Below is the snippet of code from my HTML file: <input type="checkbox" id="RocketElement" data-id="1"> And here is the JavaScript/jQuery c ...

The captivating logo animation of Google Chrome

For optimal viewing experience, it is recommended to use Chrome or any WebKit browser. https://www.google.com/intl/en/chrome/browser/ Hovering over the chrome logo reveals an amazing effect. I tried downloading the page source, but got lost in it. The s ...

What is the Solution for Adjusting the Dimmed Text Selection Shade in Safari? - CSS

Can someone help me with an issue I'm having on my website? I've been using CSS code to change the color of selected text, and it's working perfectly fine on every browser except for Safari. In Safari, the color appears darker than what I&ap ...

Div's external dimension not being computed

I am attempting to calculate the overall height of the div content in order to expand the sticky-container and create the appearance that the image is tracking the user. Unfortunately, using outerHeight does not seem to be effective for some reason. While ...

Creating a stunning 3D panorama using Three.js and CSS3D is easier than you think, and

After successfully achieving my goal using WebGL, I am now attempting to create a CSS3D fallback. However, the method used in WebGL won't work as CSS3D cannot handle meshes. Is there a way to render a panorama in CSS3D using a single panoramic image ...

Is there a way to contain the text within a div and have the div expand downwards if the text is too large?

Is there a way to ensure that text stays inside a div even if it exceeds the width, with the div's height expanding to fit the entire text? UPDATE: Thank you all for your help so far. Should I use 'Inherit' or 'min-height'? A ba ...

Steps for creating a bold column in an HTML display

Here is my PowerShell script that generates a nicely formatted HTML table. I am struggling to figure out how to make just one column (Full %) bold within the table. I have attempted inserting bold tags in various places and considered using the replace fu ...

Unable to trigger onClick event

The button I have with the id "jump-button" is not functioning at all. When clicked, nothing happens. I have added an alert(); to the onclick attribute to test if the button is working. However, the other two buttons (next and prev) are working perfectly ...

Ways to conceal an item by considering the size of a different element

I have a question about displaying content within a div element. I want to show a "show more" button only if the content inside the div exceeds a max height of 530px. Otherwise, the button should remain hidden. Here is the code snippet I'm using: Ja ...

Having trouble making ngMouseEnter (and other similar commands) function correctly

I'm currently working with Bootstrap 4 on Angular 6, and I have a delete button that I want to change its icon when the cursor hovers over it. I've tried using various ng functions like ngMouseOver and ngMouseUp, but none seem to be effective in ...