Creating a webpage with a CSS layout that features a div element containing a text area

Seeking guidance with my limited understanding of html/css on creating a div layout for a form, as depicted in the image below:

https://i.sstatic.net/Hl8k3.jpg

My attempt resulted in quite a mess, so I'm looking for advice on the best approach to implement this div layout.

Below is my current html/css code, but it's not achieving the desired result of aligning input boxes/buttons next to their corresponding labels like shown in the image. Additionally, I'm unsure if my code accurately reflects the overall concept of replicating the div layout from the image:

.flex-container {
  display: flex;
}

.flex-child {
  flex: 1;
  border: 2px solid red;
  width: 100%;
  margin-right: 20px;
}

.flex-child:first-child {
  margin-right: 20px;
}
<h1>The td rowspan attribute</h1>

<div class="flex-container">
  <div class="flex-child">
    Label

    <div class="flex-child">
      Label
    </div>

    <div class="flex-child">
      Label
    </div>
    <div class="flex-child">
      <textarea id="w3review" name="w3review" rows="4" cols="50"></textarea>
    </div>

  </div>

  <div class="flex-child">
    Label
    <div class="flex-child">
      <textarea id="w3review" name="w3review" rows="4" cols="50"></textarea>
    </div>

  </div>

  <div class="flex-child">
    Text
    <div class="flex-child">
      Label
      <div class="flex-child">
        Button

      </div>

    </div>

There should be 2 text area boxes that can expand vertically when dragged by the user.

Any assistance on this matter would be greatly appreciated. Thank you.

Answer №1

It seems like you're looking to restrict the horizontal expansion of a textarea, but it's not entirely clear what you want to achieve. One way to limit textarea width is by applying

style="max-width:200px"
to the textarea element.

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

text box with an immobile header

As the browser window size decreases, the layout changes. However, when scrolling down, the search text box moves up and is no longer visible due to its lack of fixation. How can I make the search text box stay fixed as I scroll down? I tried implementing ...

A full-width CSS menu featuring dropdowns beneath each entry for easy navigation

Check out the JSFiddle here I've created a full-width CSS menu that spans the entire screen, but I'm struggling to figure out how to make the corresponding subnav items appear below their parent items. Is it even possible to achieve this design ...

Determining the primary image in Galleriffic

After a recent inquiry, I am in the process of revamping a webpage to incorporate Galleriffic for optimized image loading, requiring me to delve deep into the intricacies of the task. I am encountering challenges in identifying the currently active image ...

Issue with table cell resizing improperly with scrollable pre content

I'm facing a challenge with resizing my table cell correctly within a variation of the "holy grail" layout. The behavior differs when displaying my main content as a block versus a table-cell. The issue seems to stem from having a scrollable pre bloc ...

Change the right border style for the second and third ToggleButtons in the ToggleButtonGroup

I've been working on this for a few hours now and I can't seem to get it right. Currently, I'm using Mui v5 and trying to style the ToggleButtons to look like regular MUI buttons. So far, I was able to achieve this transformation: https:/ ...

Unable to Locate CSS File in Separate Folder in HTML

I am struggling to link my stylesheet from a different directory to my HTML files, even though I believe I am using the correct method. Could it be that I am targeting the wrong level? '-' represents levels Take a look at my file structure: my ...

Unable to alter the height of table data cells in Mozilla Firefox

The td height is being stretched out as shown in the image. I experimented with various solutions: Setting the td height to 1px and allowing the content to stretch it. Adding a style and setting the height to 1 px Including a div tag on the conten ...

Retrieve the ng-model value from one div and pass it to another div

I am trying to retrieve the value of ng-model from one div and use it in another div. HTML: <div class="form-group" ng-repeat="key in condition.keys"> <select class="form-control" ng-show="key.aggregator" ng-model="key.aggregator" ng-options ...

Having trouble stacking the video iframe over the menu content despite setting the z-index correctly

I can't seem to figure this out. I attempted adjusting the z-index on the iframe element, but it continues to be positioned behind the menu on this page. Lowering the z-index on various sections of the navigation menu hasn't helped either. link ...

Is it possible for jQuery UI Dialog to function similar to an iFrame?

Is there a way to set up my dialog box with a form so that when the form is submitted, only the dialog box changes instead of the browser location? ...

Can an element on a webpage be dynamically assigned an ID using JavaScript or PHP?

Is it possible to dynamically set the ID of an element during runtime of a webpage? Let's consider this scenario - <body id="body1"> Now, I would like to dynamically set the ID of this "body" element using a variable value in PHP code. Is som ...

Execute a function upon pressing the enter key

Currently, I am working on coding a webpage with a form that includes one field where users input a set of numbers. After typing in the numbers, they should then press a button labeled 'Run' to execute the code. However, the issue arises when use ...

How to efficiently center a jQuery Mobile Dialog on the screen using custom dimensions

I designed an app using jQuery Mobile and I'm looking to display a Dialog box when a button is clicked. The Dialog box should be centered on the screen with specified width and height. For reference, you can view the current version on jsfiddle. The ...

What strategies can I use to solve this JavaScript puzzle?

One of my acquaintances has a webpage online that contains an inline script tag, featuring a JavaScript function: (#1): var domain = window.location.protocol + "//" + window.location.host + '/'; $(document).ready(function() { var count = 5 ...

The HTML tags within the title of a JQuery UI Dialog modal are failing to display properly

I am currently implementing a modal in my application. However, I am facing an issue where the modal title is displaying html tags instead of rendering them properly. https://i.sstatic.net/nUXPt.png Upon inspection, it seems that the dialog title is not b ...

Step-by-step guide on accessing values from a JavaScript object

I have a dictionary variable declared within a script tag on an HTML page. My goal is to retrieve the values associated with the "Roads" and "Intersections" keys, which change each time the page is refreshed. By capturing these values, I can then use JavaS ...

What is the best way to align the logo image to the left side of the Material UI app bar without any gaps?

Currently, I am working on a material UI app bar to serve as my navigation bar. The issue I am encountering involves the logo image on the left side of the page having excessive spacing from the edge, as shown in the image below. I've tried adjusting ...

Sending a Form via Jquery with Ajax

Fiddle Link And Code Snippet: $("form.signupform").submit(function(e) { var data = $(this).serialize(); var url = $(this).attr("action"); var form = $(this); // Include this line for reference $.post(url, data, function(data) { try { ...

`What is the method for retrieving controller functions in karma test scenarios?`

I am a beginner when it comes to Angular and Karma. Here is an example of a controller in Angular: angular.module('login').controller('LoginCtrl', function ($scope, $location) { var vm = this; $scope.text = 'Hello World!& ...

Avoid changing the button color to a lighter shade when it is clicked

Is there a way to prevent button text from changing to a lighter color after clicking? I am facing an issue where the button I set to red turns slightly whiteish after it is clicked. How can I ensure that the button stays red at all times? Header Toolbar ...