text stringlengths 0 106k |
|---|
.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%; |
} |
``` |
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, a new div with the class `input-container` is added which contains both the label and the textarea. The `text-align: left;` style in the `.input-container` class ensures that the label is left-aligned. The `width: 100%;` style makes the `input-container` div take up the full width of its parent co... |
[USER]: i want the text box div(along with the label ) to start the the begging of the main container (ofcourse with some margin at the top) |
[AI]: Sure, you can move the input container to the top of the main container by removing the `justify-content-center` class from the main container, and adding some margin to the top of the input container. |
Here's the updated HTML: |
```html |
<!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 here..."></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> |
``` |
And the updated CSS: |
```css |
body { |
background: #f8f9fa; |
} |
.container { |
padding: 2rem; |
} |
.input-container { |
text-align: left; |
width: 100%; |
margin-top: 2rem; |
} |
.form-label { |
font-size: 0.8rem; |
font-weight: bold; |
color: #333; |
margin-bottom: 0.5rem; |
} |
.form-control { |
height: auto; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.