Encountering overlap issues when applying labels to my flexbox using the Spectre framework in CSS

I need help creating a "hat" with two textarea columns using the spectre.css framework. My goal is to have these columns resize based on the screen size, stacking on top of each other when the screen size is below 600px. I can achieve this without any issues as long as the textarea doesn't have an associated label. But when there's a label, it causes the textarea to overlap the current column space at the bottom. It seems like the label isn't being factored in when calculating the column size and I'm not sure why. Can you help me fix this issue?

*, ::before, ::after {
  box-sizing: border-box;
}

.container {
  margin-left: auto;
  margin-right: auto;
  padding-left: .4rem;
  padding-right: .4rem;
  width: 100%;
}

.columns {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  margin-left: -.4rem;
  margin-right: -.4rem;
}

.column {
  -ms-flex: 1;
  flex: 1;
  max-width: 100%;
  padding: .25rem;
}

.col-12,
.col-11,
.col-10,
.col-9,
.col-6 {
   -ms-flex: none;
    flex: none;
}

.col-12 {
  width: 100%;
}

.col-10 {
  width: 83.33333333%;
}

.col-9 {
  width: 75%;
}

.col-6 {
  width: 50%;
}

@media (max-width: 600px) {
  #hattop {
    height: 35vh;
  }
  
  .column.col-sm-12,
  .column.col-sm-11 {
   -ms-flex: none;
    flex: none;
  }
  
 .col-sm-12 {
    width: 100%;
  }
  
  .col-sm-11 {
    width: 91.66666667%;
  }
}

.col-mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.col-ml-auto {
  margin-left: auto;
}

.col-mr-auto {
  margin-right: auto;
}

.form-label {
  color: #fff;
}

.form-input {
  appearance: none;
  background: #fff;
  border: .05rem solid #5755d9;
  border-radius: 10px;
  color: #3b4351;
  max-width: 100%;
  padding: .25rem .4rem;
  position: relative;
  transition: background .2s, border .2s, box-shadow .2s, color .2s;
  width: 100%;
  word-wrap: anywhere;
}

textarea {
  overflow: auto;
  resize: none;
}

textarea.form-input {
  height: 100%;
  width: 100%;
}

#hattop {
  background-color: rgb(31, 26, 44);
  padding: 1rem .5rem;
  height: 50vh;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}

@media (max-width: 600px) {
  #hattop {
    height: 35vh;
  }
}
<div class="container">
    <div class="columns col-sm-11 col-10 col-mx-auto">
        <div id="hattop" class="columns col-9 col-mx-auto">
            <div class="column col-sm-12 col-6 col-ml-auto">
                <label for="nams" class="form-label">Enter names separated by line</label>
                <textarea class="form-input" id="names" placeholder="Names"></textarea>
            </div>
            <div class="column col-sm-12 col-6 col-mr-auto">
                <label for="tasks" class="form-label">Enter tasks separated by line</label>
                <textarea class="form-input" id="tasks" placeholder="Tasks"></textarea>
            </div>
        </div>
    </div>
</div>

Answer №1

Resolved the issue by adjusting the #hattop height attribute in conjunction with the textarea height attribute set to 100%. This caused the textarea to always match the full height of the hattop, without considering the label.

Removed the #hattop height attribute and updated the textarea height attribute to be 50vh for screens larger than 600px, and 20vh for smaller screens. The size remains consistent but is now responsive!

*, ::before, ::after {
  box-sizing: border-box;
}

.container {
  margin-left: auto;
  margin-right: auto;
  padding-left: .4rem;
  padding-right: .4rem;
  width: 100%;
}

.columns {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  margin-left: -.4rem;
  margin-right: -.4rem;
}

.column {
  -ms-flex: 1;
  flex: 1;
  max-width: 100%;
  padding: .25rem;
}

.col-12,
.col-11,
.col-10,
.col-9,
.col-6 {
   -ms-flex: none;
    flex: none;
}

.col-12 {
  width: 100%;
}

.col-10 {
  width: 83.33333333%;
}

.col-9 {
  width: 75%;
}

.col-6 {
  width: 50%;
}

@media (max-width: 600px) {

  .column.col-sm-12,
  .column.col-sm-11 {
   -ms-flex: none;
    flex: none;
  }
  
 .col-sm-12 {
    width: 100%;
  }
  
  .col-sm-11 {
    width: 91.66666667%;
  }
}

.col-mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.col-ml-auto {
  margin-left: auto;
}

.col-mr-auto {
  margin-right: auto;
}

.form-label {
  color: #fff;
}

.form-input {
  appearance: none;
  background: #fff;
  border: .05rem solid #5755d9;
  border-radius: 10px;
  color: #3b4351;
  max-width: 100%;
  padding: .25rem .4rem;
  position: relative;
  transition: background .2s, border .2s, box-shadow .2s, color .2s;
  width: 100%;
  word-wrap: anywhere;
}

textarea {
  overflow: auto;
  resize: none;
}

textarea.form-input {
  height: 40vh;
  width: 100%;
}

@media (max-width: 600px) {
    textarea.form-input {
    height: 20vh;
  }
}


#hattop {
  background-color: rgb(31, 26, 44);
  padding: 1rem .5rem;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}
<div class="container">
    <div class="columns col-sm-11 col-10 col-mx-auto">
        <div id="hattop" class="columns col-9 col-mx-auto">
            <div class="column col-sm-12 col-6 col-ml-auto">
                <label for="nams" class="form-label">Enter names separated by line</label>
                <textarea class="form-input" id="names" placeholder="Names"></textarea>
            </div>
            <div class="column col-sm-12 col-6 col-mr-auto">
                <label for="tasks" class="form-label">Enter tasks separated by line</label>
                <textarea class="form-input" id="tasks" placeholder="Tasks"></textarea>
            </div>
        </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

Integrate buttons for increasing and decreasing with the `<select>` element in HTML

Apologies for what may seem like a trivial question, but I am truly stuck. Despite searching extensively, I cannot find how to create a basic HTML tag with increase and decrease buttons aligned to the right. Your assistance would be greatly appreciated. Th ...

Create a custom overlay for an image that is centered horizontally and does not have a fixed width

I'm working with this HTML setup: <div class="container"> <img class="image" /> <div class="overlay"> <div class="insides">more content here</div> </div> &l ...

Can someone explain why my table in Laravel is only showing the third set of data and not the others?

I'm facing an issue with displaying all of the data in my table named taglineImageCarousel. The problem lies in the slide_ID column, where it is being populated with data from slide-01, slide-02, and slide-03. Below is the code snippet: taglineImage ...

What is the best way to align text alongside icons using ng-bootstrap in Angular 8?

I have a set of four icons positioned next to each other, but I want them to be evenly spaced apart. I tried using the justify-content-between class, but it didn't work. How can I achieve this? I'm creating a Progressive Web App (PWA) for mobile ...

how to use beautifulsoup to insert a new tag within a text block

When a browser encounters the text www.domain.com or http://domain.com/etc/ within an HTML text section, it automatically converts it into <a href="http://www.domain.com">www.domain.com</a> or <a href="http://domain.com/etc/">http://domai ...

Tips for locating and interacting with a specific element using Selenium

I am delving into the realm of Python and honing my skills by creating practical applications for daily use. I recently embarked on automating a routine task, but hit a roadblock when attempting to utilize selenium to click on a specific element that dynam ...

Toggle visibility of anchor tags on screens with lower resolution

Looking for help with my code <div id="contact-buttons-bar" class="slide-on-scroll" data-top="250px" style="left: 0px;"> <button class="contact-button-link show-hide-contact-bar" style="left: 0px;"> <a class="contact-button-link cb-ancor f ...

Tips for merging identical media queries into a single query using SASS

Previously, I organized my media queries in LESS by combining them at a single place like this LESS: .media-mixin(@break) when (@break = 1200px) { .abc{ color: red; } } .media-mixin(@break) when (@break = 1200px) { .xyz{ color: yellow; ...

Is there a way to specify the dimensions of the canvas in my image editing software based on the user-input

Here is the code and link for my unique image editor. I would like to allow users to enter the desired width and height of the selection area. For example, if a user enters a width of 300 and height of 200, the selection size will adjust accordingly. Addit ...

When combining li, radio-input, and label, there is no padding at the top

I am facing an issue with the padding at the top of my list items. Here is a link to a working Fiddle: [http://jsfiddle.net/TH3zq/9/][1] http://jsfiddle.net/TH3zq/9/ Can anyone suggest a CSS style solution for this problem? Thanks, John ...

Leverage multiple services within a single AngularJS controller

Is it possible to use multiple services in the same controller? Currently, I am able to achieve this with different services, but it seems to only perform one service. <!DOCTYPE html> <html> <script src="http://ajax.googleapis.com/ajax/libs ...

Remove the source code upon accessing the inspector tool

I recently encountered a page with encrypted source code. The content is being loaded from two separate sources stored in JavaScript files. My question is: Is it feasible to completely remove the HTML source code when a user opens the inspector (F12, etc ...

Struggling with IE7 compatibility issues regarding tables inside a div? Seeking a reliable resource to gain insights and strategies for effectively resolving IE7 problems

I am currently in the process of revamping this website: but I am facing a challenge with repeating a gradient within a div (cnews). The problem arises when the gradient is repeated on IE7, as it distorts the color. It appears as though the blue in the im ...

How to Implement Multi Select Drag and Drop Feature in Angular 4?

Currently, I am implementing Angular 2 Drag-and-Drop from this library to enable the selection of list items using a drag and drop method. However, I have encountered issues with its functionality on touch devices and when attempting to perform multiple it ...

Leveraging the power of Javascript and Firebase within the Angular framework

When attempting to integrate Firebase with Angular, I encountered an issue where my localhost was not able to function properly with my JavaScript code. The strange thing is that everything works fine when the code is placed directly in the index.html file ...

Change the height of textarea dynamically using jQuery

I am trying to create a comment box similar to Facebook's, where it resizes as text fills it using Expanding Text Areas Made Elegant This is how my view looks: <div class='expandingArea'> <pre><span></span></ ...

Modify content or display picture within accordion panel based on its identifier

In my view, I have a model representing a list of items. Each item has a unique ID, which is included in the H2 header tag. The details of each item are displayed in a div below the header. Initially, there is an image within the header that is set to disp ...

The problem with the Bootstrap Navbar Dropdown is that it opens up within the confines of

I have created a navigation bar using Bootstrap 4 and included the .navbar-bottom class to enable scrollbar functionality when there are more menu items than the total width of the page. However, an issue has arisen where the Bootstrap 4 navbar dropdown o ...

Ways to improve the transition of a <video> background using CSS

My webpage features a unique 10-second video wallpaper achieved using only pure CSS. Below is the code I used: <style> video#bgvid { position: fixed; right: 0; bottom: 0; min-width: 100%; min-height: 100%; width: auto; he ...

Can the color of text be adjusted (to either white or black) based on the background color (in any color and format)?

To achieve a text color that contrasts well with any background, I need to make sure it's either black or white. The background in my app can vary in color and format, so finding the perfect solution has been challenging. Using mix-blend-mode doesn&a ...