Even after applying the CSS property "resize:none" to my HTML textarea, I still find it to be adjustable in size when viewed in the Opera browser

I'm currently working on customizing my HTML page and I want to ensure that all text inputs are consistent in size.

I attempted to use the text-area selector in CSS, but it didn't seem to work correctly in Opera. The resize handle disappeared in Mozilla Firefox, and even though I specified the rows and columns for the text-area, it didn't display as expected.

The following code snippet:

<textarea style="resize:none" rows="1" cols="22" th:id="inputWord" name="inputWord"></textarea>

does the job, but I'm puzzled as to why CSS isn't affecting it here.

textarea {
  rows: 1;
  cols: 22;
  resize: none;
}
<div class="container">
  <div class="container-inner">
    <div class="area">
      <form th:action="@{/}" method="post">
        <textarea th:id="inputWord" name="inputWord"></textarea>
        <textarea th:id="inputTranslation" name="inputTranslation"></textarea>
        <textarea th:id="language" name="language" value="English"></textarea>
        <input type="submit" th:id="addWord" value="add" />
      </form>
    </div>
    <div class="area">
      <form th:action="@{/delete}" method="post">
        <textarea th:id="inputWordDelete" name="inputWordDelete"></textarea>
        <textarea th:id="inputTranslationDelete" name="inputTranslationDelete"></textarea>
        <textarea th:id="languageDelete" name="languageDelete" value="English"></textarea>
        <input type="submit" th:id="deleteWord" value="delete" />
      </form>
    </div>
  </div>
</div>

Answer №1

rows and cols are attributes for <textarea>, not CSS properties:

textarea {
  resize: none;
}
<div class="container">
  <div class="container-inner">
    <div class="area">
      <form th:action="@{/}" method="post">
        <textarea rows="1" cols="22" th:id="inputWord" name="inputWord"></textarea>
        <textarea rows="1" cols="22" th:id="inputTranslation" name="inputTranslation"></textarea>
        <textarea rows="1" cols="22" th:id="language" name="language" value="English"></textarea>
        <input type="submit" th:id="addWord" value="add" />
      </form>
    </div>
    <div class="area">
      <form th:action="@{/delete}" method="post">
        <textarea rows="1" cols="22" th:id="inputWordDelete" name="inputWordDelete"></textarea>
        <textarea rows="1" cols="22" th:id="inputTranslationDelete" name="inputTranslationDelete"></textarea>
        <textarea rows="1" cols="22" th:id="languageDelete" name="languageDelete" value="English"></textarea>
        <input type="submit" th:id="deleteWord" value="delete" />
      </form>
    </div>
  </div>
</div>

Instead of using rows and cols, you can achieve similar results with CSS by using the height and width properties. By specifying the values in em units, you can closely mimic the behavior of rows and cols respectively:

textarea {
  height: 1em;
  width: 22em;
  resize: none;
}
<div class="container">
  <div class="container-inner">
    <div class="area">
      <form th:action="@{/}" method="post">
        <textarea th:id="inputWord" name="inputWord"></textarea>
        <textarea th:id="inputTranslation" name="inputTranslation"></textarea>
        <textarea th:id="language" name="language" value="English"></textarea>
        <input type="submit" th:id="addWord" value="add" />
      </form>
    </div>
    <div class="area">
      <form th:action="@{/delete}" method="post">
        <textarea th:id="inputWordDelete" name="inputWordDelete"></textarea>
        <textarea th:id="inputTranslationDelete" name="inputTranslationDelete"></textarea>
        <textarea th:id="languageDelete" name="languageDelete" value="English"></textarea>
        <input type="submit" th:id="deleteWord" value="delete" />
      </form>
    </div>
  </div>
</div>

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

Tips for transforming the appearance of an asp.net page with asp:Content into a stylish css-page

Currently facing an issue where I am unable to change the background-color in my CSS file. As a workaround, I have placed the style directly within an ASP page. <asp:Content Id="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> ...

When the window width increases, the image within a flexbox causes the flexbox to break

I'm currently working on designing a responsive splash page that covers most of the page (90vh). The layout includes a logo at the top and a simple paragraph at the bottom. I've experimented with using flex-shrink and flex-basis, but it's n ...

Error: The variable "deleted1" is not declared and cannot be used on the HTML button element's onclick

Hello, I need assistance from someone. I encountered an error message after trying to delete a row even though I have declared the button already. Error: deleted1 is not defined at HTMLButtonElement.onclick Could it be due to the script type being modul ...

Exploring the benefits of utilizing Scoped CSS for individual components within Next.js version 13

Switching from a Vue.js background to starting with Next.js, I want to scope my CSS for each component such as Navbar instead of using it inside Globas.css. Is there a way to achieve this? I am also utilizing the Tailwind CSS library. I attempted creatin ...

The jQuery div enclosure technique

I am trying to wrap HTML around an existing div, here is what I have attempted: HTML: <input type="text" data-placeholder="username" /> It should look like this when rendered: <div class="placeholding-input"> <input type="text" data-pl ...

Calculate the sum of hours worked in a day using pure JavaScript, no external libraries required

Hello, I'm new to this website and please excuse me if my English is not perfect, I am trying my best to communicate :) I have been working on a page that calculates the total hours worked in a day and this is what I have achieved so far until 15/06 ...

Is there a substitute for bootstrap select in Rails?

In order to style select tags with Bootstrap, we had to utilize the gem: bootstrap-select However, due to the high volume of options in our data-heavy application, the select dropdowns are causing significant slowdown (loading times, drop down performance ...

Searching for a specific text within a column and displaying only the matching parts

My current dataframe has the following structure: RandomCol raw blah <div style="line-height:174%;text-align:left;font-size:9pt;"><font style="font-family:inherit;font-size:9pt;font-style:italic;font-weight:bold;">We ...

Location of chat icon in Dialogflow messenger

After successfully embedding the Dialogflow messenger in my website, I noticed that in mobile view, the chat icon is blocking the bottom navigation bar. You can refer to the screenshot here. Is there a way to reposition the chat icon higher on the page? I ...

Incorporating jQuery to Load Content into a DIV while preserving the original JavaScript

I am attempting to implement the following <script> $(document).ready( function() { var data = 'testing' $("#about").on("click", function() { $("#main-content").load("/about.html"); ...

Achieving Horizontal Alignment in a Dropdown Menu with Bootstrap 4

I am utilizing a dropdown that contains 3 main "categories", each with multiple checkboxes for filtering search results. Below is an example: <div class="dropdown"> <button type="button" class="btn dropdown-toggle" data-toggle="dropdown">B ...

What is the best way to showcase the keys of a Python dictionary in an HTML table with the values of each key displayed as a row under its corresponding table header?

I am currently involved in a django project where I perform data analysis using the pandas library and would like to showcase the data (which has been converted into a dictionary) as an HTML table. This is the dictionary I wish to present: my_dict = { ...

Exploring the process of passing parameters in Material-UI React styled components

Recently, I developed a new component const CategoryDialog = (props) => { const classes = useStyles(); console.log(props); return ( <div> <Dialog fullScreen open={props.dilaogOpenProp} TransitionCompone ...

Shifting Divs/Text while adjusting zoom levels in HTML/CSS with Bootstrap

As a newcomer to the coding world, I am encountering an issue with my Navbar. Everything appears fine at 100% zoom on the browser, but when I zoom in to 150%, everything becomes jumbled. How can I ensure that everything stays the same size regardless of zo ...

I've been attempting to upload application/pdf files, but I'm having trouble. Can you provide me with instructions

'<?php $allowedExts = array("jpg", "jpeg", "gif", "png"); $extension = end(explode(".", $_FILES["file"]["name"])); if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/ ...

"Utilizing a media query to display an anchor link at the top based

How can I create a "Back to Top" link that automatically scrolls mobile and tablets to the top of the page? Usually, I would achieve this using JavaScript by detecting the window and body height. Is it possible to accomplish this using a media query? @me ...

The CSS method for changing the content URL is experiencing difficulties in Firefox

Css: .woocommerce-placeholder.wp-post-image { content: url("DSC0926-1.jpg"); } /*for firefox*/ .woocommerce-placeholder.wp-post-image::before { content: url("DSC0926-1.jpg"); } HTML <img src="placeholder.png" alt="Placeholder" class="woocomm ...

Switching the position to fixed causes it to lose its justification functionality

My goal is to create a table using div elements. However, when I set the header to have a fixed position to prevent it from disappearing when scrolling through more data, all the header cells shift to the right. I attempted to adjust the margin-left proper ...

Is there a way to arrange three of these cards side by side using CSS to alter their layout?

Hey everyone, I currently have a page that looks like this: Check out the current page I'm looking to change it so that instead of one image per row, there are three images per row (and reduce their size to fit three in a row). Here is my current c ...

How to Determine If a String Represents an HTML Tag Using jQuery

Checking if a string is an HTML tag can be tricky. I've tried various methods found on Google, but none have been successful so far: var v = $(string).html() ? 1 : 0; --or---------------------------------------------- var htmlExpr = new RegExp("/^( ...