text
stringlengths
0
106k
font-size: 1.2rem;
overflow: hidden;
resize: none;
}
.btn {
height: 3rem;
font-size: 1.2rem;
width: 100%;
}
```
The JavaScript remains the same:
```javascript
let textarea = document.querySelector('textarea');
textarea.addEventListener('input', autoResize, false);
function autoResize() {
this.style.height = 'auto';
this.style.height = this.scrollHeight + 'px';
}
```
In this updated code, the `justify-content-center` class is removed from the main container, which makes its children start from the top. The `mt-auto` class is added to the button to push it to the bottom. The `margin-top: 2rem;` style in the `.input-container` class adds some space above the input container.
[USER]: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Simple Website</title>
<!--Bootstrap CSS-->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<!--Custom CSS-->
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container d-flex flex-column align-items-center vh-100">
<div class="input-container">
<label for="prompt" class="form-label">Prompt</label>
<textarea id="prompt" class="form-control mb-3" rows="1" placeholder="Type a prompt..."></textarea>
</div>
<div class="input-container">
<label for="prompt" class="form-label"> Negative Prompt</label>
<textarea id="prompt" class="form-control mb-3" rows="1" placeholder="Type a negative prompt..."></textarea>
</div>
<button class="btn btn-primary mt-auto">Submit</button>
</div>
<!--Bootstrap JS-->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<!--Custom JS-->
<script src="script.js"></script>
</body>
</html>
body {
background: #f8f9fa;
}
.container {
padding: 2rem;
}
.input-container {
text-align: left;
width: 100%;
}
.form-label {
font-size: 0.8rem;
font-weight: bold;
color: #333;
margin-bottom: 0.5rem;
}
.form-control {
height: auto;
font-size: 1.2rem;
overflow: hidden;
resize: none;
}
.btn {
height: 3rem;
font-size: 1.2rem;
width: 100%;
}
let textarea = document.querySelector('textarea');
textarea.addEventListener('input', autoResize, false);
function autoResize() {
this.style.height = 'auto';
this.style.height = this.scrollHeight + 'px';
}
Why does the negative prompt field not auto resize like the propt field
[AI]: The reason the second textarea is not auto-resizing is because the JavaScript code is selecting only the first textarea in the document with `let textarea = document.querySelector('textarea');`.
To apply the auto-resize effect to all textareas, you need to select all textareas and add the event listener to each of them. Here's how you can do it: