Expanding the size of a text area input within a form using CSS and

How can I adjust the size of the text area in the Comment section to match the full width of the section, starting from the beginning instead of the middle? You can find the code here.

HTML

  <body bgcolor="#00BCD4">

  <div>
    <h1>Contact me</h1>

    <form action="MAILTO:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2449416449410a474b49">[email protected]</a>" method="post" enctype="text/plain">
      <label for="name"><font face="Roboto"><font color="red">*</font>Name</font>
            </label>
      <input type="text" name="name" required>
      <br>
      <label for="email"><font face="Roboto"><font color="red">*</font>E-mail</font>
            </label>
      <input type="text" name="mail" required>
      <br>
      <label for="comment"><font face="Roboto"><font color="red">*</font>Comment</font>
            </label>
      <input type="text" name="comment" style="height:220px;">
      <input type="submit" value="Send">
      <input type="reset" value="Reset">
    </form>
    <h2>or you can contact me in game @</h2>
    </div>

  </body>

CSS

@import url(https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700);
@import url(https://fonts.googleapis.com/css?family=Roboto);
input[type=text],
select {
  width: 100%;
  padding: 12px 20px;
  margin: 8px 0;
  display: inline-block;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  font-family: 'Roboto', sans-serif;
}

input[type=submit] {
  width: 30%;
  background-color: #4CAF50;
  color: white;
  padding: 14px 20px;
  margin: 8px 0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 110%;
}

input[type=reset] {
  width: 25%;
  background-color: #f44336;
  color: white;
  padding: 14px 20px;
  margin: 8px 0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 110%;
}

input[type=submit]:hover {
  background-color: #45a049;
}

input[type=reset]:hover {
  background-color: #d32f2f;
}

div {
  border-radius: 5px;
  padding: 40px;
  margin: 0;
}

form {
  width: 300px;
  margin: 0 auto;
}

label {
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 110%;
  font-weight: bold;
}

h1 {
  font-weight: bold;
  font-family: 'Roboto Condensed', sans-serif;
  text-align: center;
}

h2 {
  font-weight: bold;
  font-family: 'Roboto Condensed', sans-serif;
  text-align: center;
}

Answer №1

It is recommended to incorporate a textarea element within your form

<textarea cols="9(depending on your preference)" rows="9(depending on your preference)" name="comment"></textarea>

rather than using this:

<input type="text" style="height:220px;" >

Answer №2

To achieve this, opt for a

<textarea></textarea>
over an <input type="text">.

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

The TD border is slicing through the div and is placed on the table in IE standards, causing it

Below is the HTML code where the div is being cut by the table border when the page is in standards mode. Interestingly, if I remove the <!DOCTYPE html>, then it works fine as expected. The issue of the outside div not behaving properly on the table ...

Use CSS to mimic the :hover functionality for touchscreen devices

I am struggling to get this piece of code to function correctly, $(document).ready(function() { $('.hover').bind('touchstart touchend', function(e) { e.preventDefault(); $(this).toggleClass('hover_effect'); }); ...

Press on the menu <li> item to create additional submenus

A group of friends is facing a challenge. They want to create a dropdown sub-menu that appears directly below the selected item when clicking on a link from a menu. So far, they have been able to use ajax to send requests and generate a sub-menu. However, ...

Is it better to define the SVG `viewbox` once in a `symbol`, or each time an SVG is `used`?

Based on my research, some tutorials suggest that when inserting an SVG <symbol> with <use>, the viewBox property only needs to be defined once - in the <symbol> tag. While this method seems to work fine, it results in the contents of th ...

Correcting the reference to "/" (root) for assets after relocating the site to a subdirectory

I currently have a website located in the public_html directory, where all assets (images, css, js, etc) are referenced using /asset_folder/asset. The "/" at the beginning ensures that the browser starts from the root and navigates through the directories. ...

What is the best way to position a div to float or hover from the bottom after it has been

I am working on creating a menu where clicking it will reveal a submenu at the bottom, but I'm encountering an issue. Currently, in my code, the submenu is appearing from right to left before moving down. Here is my code: <meta name="viewport" co ...

Aligning images in a table grid of 300px by 300px dimensions

I've included my code below and I am searching for the most effective method to use CSS to center an image both horizontally and vertically within a 300 by 300 pixel square. If the image is larger, it should be resized to fit within the square, while ...

Enhance Your Images with Hovering Icons

Is there a way to display an icon checkmark over the main image when a user hovers over it? The icon should appear in the top right corner of the image. <div> <img class="result-image" src="{{$property->photo}}"> <! ...

Limit the number input to only allow values between 0 and 100

I am utilizing the Number input component from MUI, which includes Increment and Decrement buttons for adjusting numbers. Is there a method to limit the input to only accept values ranging from 0 to 100 ? Additionally, how can I decrease the width of the ...

How come my container-fluid div isn't encompassing the box divs too?

I am currently in the process of creating a dice using the bootstrap grid system. Although I have not completed it yet, here is a small snippet of the code that showcases my progress. However, when I inspect my webpage using developer tools (see attached i ...

I'm still unclear on the necessity of using clear:both

Presenting a simplified example of my previous query, I am still seeking clarification regarding the necessity of using clear:both to enable padding-top. Can someone provide a straightforward illustration to elucidate the usage of float and clear? Hence, ...

Is it possible to maintain tab focus instead of visual focus when navigating past the skip navigation menu for improved accessibility?

My website features an accessibility skip navigation menu that utilizes named anchors to navigate to different content areas. These content areas, including the top menu, left menu, main body content, and footer menus, contain links within them. When I u ...

What is the best way to dynamically insert a new row into a table, with each row containing a table heading and column?

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <table id="tbl" class="tbl1"> <tr> <th> mobileno </th> <td class='mo' id="mo_0"> </td> ...

Ensure that the context is used to effectively clear any existing data from the previous bar chart

I recently came across a cool codepen demo on this link. Upon clicking the first button followed by the second, the data transitions smoothly. However, there seems to be an issue where when hovering randomly over the bar charts at this source, the value ...

PHP causing SQL hiccup

Hey everyone, I've been struggling with this PHP code that keeps giving me an error when trying to add students. Check out the code snippet below: And here's the error message it's showing: I would appreciate any help as I'm not sure ...

Issue with preventDefault not functioning correctly within a Bootstrap popover when trying to submit a

I am facing an issue with a bootstrap popover element containing a form. Even though I use preventDefault() when the form is submitted, it does not actually prevent the submit action. Interestingly, when I replace the popover with a modal, the functional ...

Issue with node-multer: Form submission error occurs in the absence of any file for upload

Below is an HTML form that uploads a file to a server using express.js and multer. It functions correctly when a file is selected, but not when the file field is left empty. <form id="uploadform" method="post" action="/upload" enctype="multipart/form-d ...

Interacting with a span button within the parent element using its specific id with Selenium and Java

Can I click on a span button nested within a div element and use the input's id to ensure test stability? HTML: <div class="idit-go"> <input id="IDITForm@checkRuleVO" class="GoLong align-left idit-go-text" type="text" value="" title="Valida ...

Steps for generating instances of an HTML page and dynamically adding them to a list on the main page

I have a main HTML page and I need to insert a dynamically generated list from a template in another HTML file that I created. The template for each item in the list is located on a separate HTML page. My goal is to create multiple instances of this HTML ...

Using three.js to set the HTML background color as clearColor

How can I set the HTML background as clearColor using three.js? Here is the code snippet for three.js: // Setting up the environment var vWebGL = new WEBGL(); var scene = new THREE.Scene(); var camera = new THREE.PerspectiveCamera(75, window.innerWidth / ...