Dynamic Input Box

Hi there, I'm currently grappling with making my textarea responsive. I've attempted using width: 100% and max-width: 600px, but I can't seem to get it right. The container is also set at a width of 600px. When I use width: 100%, the textarea ends up smaller than the container which isn't ideal. On the other hand, when I apply max-width: 600px, the box becomes extremely tiny. Here's the snippet of my code:

<div class="container contact">
<textarea class="inputmessage"></textarea>
</div>
.inputmessage{
    float: left;
    border: 2px solid black;
    height: 150px;
    width: 600px;
}
.container{
    text-align: center;
    margin: auto;
}

.contact{
    width: 600px !Important;
}

Answer №1

Set the maximum width of the container to 600 pixels and remove the float property. Take a look at this fiddle.

.inputmessage{
    border: 2px solid black;
    height: 150px;
    width: 100%;
}
.container{
    text-align: center;
    margin: auto;
}

.contact{
    width: 100%!Important;
    max-width:600px;
}

https://jsfiddle.net/Lx89qtte/

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

Can you restrict the selection of text to only the current element?

<div class="container"> <div class="item1">text text text in div element 1</div> <div class="item2">text text text in div element 2</div> </div> Is there a way using HTML nodes, CSS, or JavaScript to restrict the select ...

Changing colors in the rows of a table

Here is a fiddle I created to demonstrate my issue. https://jsfiddle.net/7w3c384f/8/ In the fiddle, you can see that my numbered list has alternating colors achieved through the following jQuery code: $(document).ready(function(){ $("tr:even").css("ba ...

The right alignment for ul and li styles is recommended for a cleaner appearance

Here is the fiddle provided below: http://jsfiddle.net/Fx9rA/ <div id="wrap"> <ul id="accordion"> <li> <h2 id="first">CMT</h2> <div class="content"> ...

Ways to ensure that the height of the second row in the second column matches that of the first column

My current layout design is causing an issue where the lower green box extends beyond the total height of the entire box. I've provided a rough version of my code on codepen. Using the Bulma framework, my goal is to align the height of the left column ...

Is it possible for an absolutely positioned element to have floating elements wrapping around it?

Within my content box (#left-home-content), I have a series of paragraphs followed by a link in a <span> tag (.read-more-link), and then a <div> tag (#left-home-spread) that needs to be positioned absolutely at the bottom of the box. This may s ...

Tips for: Minus a CSS property from a JavaScript variable height?

Is there a way to deduct the navbar_height by 2rem in the code snippet below? navbar_height = document.querySelector(".navbar").offsetHeight; document.body.style.paddingTop = (navbar_height - 2 ) + "px"; Appreciate your help! ...

The CSS border-radius feature shapes the corners without affecting the background

When I apply a 15px rounded border to a div, the border appears rounded on the outside but the corners where the border meets the background remain square. Here is an example: http://jsfiddle.net/BQT5F/1/ I tried using the background-clip property to add ...

Clicking on the search bar in front of the background image will take you back to the homepage

The issue I am facing is with my header image that contains a search field. Whenever I click on the search input, it redirects me to the homepage because the search functionality is embedded within the <section> tag. I'm looking for a solution ...

Capturing and saving location data without internet connection, and then displaying markers once connectivity is restored

I am currently developing a web application that will monitor the user's location. I want to ensure its reliability, so even if the user loses internet connection, the application will continue tracking their location (since GPS does not rely on inter ...

Combining 2 tables using LINQ Query

I am currently working on a library management project that involves users updating their reading status when they borrow a book. I am facing an issue where, when using LINQ to join tables, everything appears correctly except for the status field. Here are ...

Generating a dataframe with cells that have a combination of regular and italicized text using the sjPlot package functions

I've been trying to set up a basic data table where the genus name in the "Coral_taxon" column is italicized, but the "spp." part following it remains lowercase. I thought of using the expression() function for each row in "Coral_taxon," but so far, I ...

Is there a way to update a div element with an image without having to refresh

Currently working on a project for my studies where I am reading the x and y coordinates from a touch pad and drawing it in real time using PHP. I have created a draw page that takes these coordinates and displays them on an image, which is then shown on ...

Querying Mysql to sort results by brand and calculate the total brand value

Hello, I am currently working on a query where I need the brand_name to be unique but the brand_value should display as sum. Below is the structure of my MySQL TABLE with Primary key: betbingo 1 www.abc.com betbingo 1 www.abc.com betbingo 2 www.abc ...

When rotating, the SVG ellipses move towards the upper left corner

Why does my animated lp end up in the top left corner instead of centering? I've tried using transform-origin: center; but it's not working. Any help would be greatly appreciated. Thank you in advance. #Component_6_2{ -webkit-transform-orig ...

Javascript function that sets the opacity to 0

Hello everyone, I'm new to SO and seeking some guidance on improving my post! I have a function that sets the opacity of an element to 0 in order to clear it. While this works fine, it becomes burdensome when dealing with multiple elements that requi ...

Interactive Navigation Path URL

I came across this code online that does almost exactly what I need it to do, but there are a few issues that I've run into. One problem is that when I click on the home tab, it adds "https" in front of the domain which causes the website to show as ...

What is the best way to assign both first and last names to an array with keys and values, then showcase the result?

<!DOCTYPE HTML> <html lang="en"> <head> <meta charset="UTF-8> <title>practice session</title> </head> <body> <!-- $name1 = first--> <!-- $name2 = last--> <?php echo " ...

Retrieve the child elements belonging to a specific type of element

My challenge involves a table identified by the id of tableDiv. I am looking to dynamically reset the values of each table header and data cells, but due to the nature of the table being created with ASP.NET (GridView), I am unable to assign classes for th ...

What is the best approach for resolving the issue of User having an Unknown field(s) (Id_card_number) specified in the system

I'm facing an issue with my code. Whenever I run a makemigrations command, it returns an error message saying Unknown field(s) (Id_card_number) specified for User. How can I resolve this problem? settings.py INSTALLED_APPS = [ 'django.contr ...

The process of dynamically inserting input types into a <td> element using the innerHTML tag is not functioning properly in Internet Explorer

I am facing an issue with dynamically placing input types within a <td> tag - the innerHTML() method is not functioning properly in Internet Explorer, although it works fine in Mozilla. This is how I am inserting the input types using JavaScript, wi ...