Is there a way to include a textarea or text input in a table row and have it expand upon clicking or dragging, without increasing the row height?

I am looking for a way to allow a textarea to expand or grow when clicked or dragged, without affecting the height of the table row it is in. You can see an example of the issue on this CodePen:

https://codepen.io/kerastensorflow/pen/PobaRvK?editors=1010

        <Table>
          <tr>
            <th>Col 1</th>
            <th>Col 2</th>
            <th>Col 3</th>
            <th>Col 4</th>
            <th>Col 5</th>
         </tr>
          <tr style = {{maxHeight:"50px"}}>
            <td><input style = {{width:"100px"}} readonly/></td>
            <td><input style = {{width:"150px"}}/></td>
            <td><input style = {{width:"150px"}}/></td>
            <td><input style = {{width:"80px"}} /></td>
            <td><textarea></textarea></td>
          </tr>
        </Table>

Answer №1

If you're looking for a quick solution, why not give this hack a shot?

.div {
  height : 60px;
  width:200px;
  overflow : auto;
}
        <Table>
          <tr>
            <th>Col 1</th>
            <th>Col 2</th>
            <th>Col 3</th>
            <th>Col 4</th>
            <th>Col 5</th>
          </tr>
          <tr style = {{maxHeight:"50px"}}>
            <td><input style = {{width:"100px"}} readonly/></td>
            <td><input style = {{width:"150px"}}/></td>
            <td><input style = {{width:"150px"}}/></td>
            <td><input style = {{width:"80px"}} /></td>
            <td><div class="div"><textarea></textarea></div></td>
          </tr>
          
        </Table>
</div>

Answer №2

To make the textarea position absolute, simply add the CSS property: position: absolute;

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

Ensure that the body background image remains stretched and perfectly centered regardless of the screen resolution

I am having an issue with vertical centering on a website I created. Everything looks fine on my monitor, but at higher resolutions, the tables don't align in the center and the image shrinks. How can I ensure that everything stays aligned properly? ...

Tips for displaying information in an Autosearch feature

I am trying to implement an auto search feature using AJAX calls, but I am facing difficulties in displaying the results on the search bar. The search results are showing up properly elsewhere. <input type="text" id="select_link" placeholder="enter th ...

Is there a way for me to adjust the image dimensions so that it doesn't surpass the width of its parent container?

When working with images, it can be tricky to set the original width while also ensuring it fits within a parent container. For example, if the parent container has a width of 1000px, you may want the image to have a max-width of 100%, but not exceed 1000p ...

Render inline CSS styles with AngularJS

Can we use angular variables to write inline CSS styles? <div style="background: transparent url({{eventInfo.eventHeaderImg}}) top center no-repeat;"></div> Here is the output I received: "NetworkError: 404 Not Found - http://test/eventInfo. ...

The conventional method for including React import statements

I'm curious if there is a standard convention for writing import statements in React. For instance, I currently have the following: import React, { useState, FormEvent } from 'react'; import Avatar from '@material-ui/core/Avatar'; ...

MERN stack project encountering PUT 401 Unauthorized error despite passing Bearer token

After successfully integrating the Razorpay payment gateway into my e-commerce website, I encountered an issue where a failure action was dispatched instead of a success action right after the payment process. The error message indicated that it was 401 un ...

Strategies for resolving a mix of different data types within a single parameter

Here, I am setting up the options params to accept a value that can either be a single string or another object like options?: string[] | IServiceDetail[] | IServiceAccordion[]; However, when attempting to map these objects, an error is encountered: Prope ...

Using AJAX and React to handle RESTful requests

Hello there, I am attempting to utilize a web service in React but am encountering issues with the AJAX function. I'm unsure if my code is working as expected. Here is a snippet of my code: prox= {"email":email, "password": password}; //tag comment $ ...

Obtain and display pictures in HTML

I am working on a code snippet that fetches images from a directory and displays them in HTML. The issue I'm facing is that the images in the directory keep changing every second, causing problems on mobile browsers where the cached images are not bei ...

What is the method for transferring properties in next JS?

When I try to pass a property while invoking a component, it doesn't seem to work as expected. I'm new to next JS and this concept is confusing me. //Example Component const ExampleComponent: React.FC = (props) => ( <section className= ...

I wonder which Material Design repository is the source of this library

I am attempting to replicate the CSS style used in this particular Material Design-inspired web application: https://i.stack.imgur.com/utalx.png After exploring Materialize CSS and MUI, I have not been able to pinpoint the exact framework responsible for ...

Conceal picture when clicked

My goal is to hide an image upon clicking and then show it again by clicking a specific tag. I've attempted various codes, but none have been successful. Every time I click, the image continues to add to the page. <body> <a href="#" class= ...

Issue encountered: Material-UI menu remains open even when a dialog is active

Currently, I am utilizing react along with material-ui. In my JSX file, I have created a dialog component as follows: export default class CartoviewAbout extends React.Component { constructor(props) { super(props); this. ...

"VS Code's word wrap feature is beneficial for wrapping long lines of text and code, preventing them from breaking and ensuring they are

text not aligning properly and causing unnecessary line breaks insert image here I attempted to toggle the word wrap feature, installed the Rewrap plugin, and played around with vscode settings ...

Using React JS to extract query string values

My current URL contains the following: http://example.com/callback?code=abcd I am trying to extract the value of "code." Here is the React code I have written: import React from 'react'; import { useEffect } from 'react'; const Callba ...

HTML with an intricate and dynamic table layout

I am attempting to design a dynamic table that looks like the one shown in this image: https://i.stack.imgur.com/0Bmur.png The challenges I face in creating this HTML table are as follows: It needs to be dynamic as it will display data from a database T ...

Ways to reduce lag while executing a for loop

How can I optimize my prime number generation process to avoid lagging? For example, is there a way to instantly display the results when generating primes up to 1000? HTML: <!DOCTYPE html> <html> <meta name="viewport" content="width=dev ...

Tips for aligning the navigation bar, main content, and footer in the center

Exploring the realm of web coding for the first time, I find myself in need of some guidance. My current project involves creating a webpage for the local sports team to replace their outdated one on Wordpress. Finding the platform not very user-friendly, ...

Send a GET request from a Node.JS server application to a React.JS client

Recently, I've been working on a project involving a Koa/Node JS backend that needs to make a GET request to an external API and pass the response body to a React JS client app. However, given my limited experience with Koa, Node JS, or servers in gen ...

Is it possible for three.js to integrate information from REST APIs?

Currently, I am in the process of learning three.js and have successfully created basic 3D models using hardcoded values. My goal now is to retrieve these values from a database that I have set up in MSSQL Server. These x, y, and z parameters are stored ...