text
stringlengths
0
106k
"https://i.ibb.co/pjbT6Gd/Photo-Real-blonde-hermione-emma-watsonpink-dress-silver-tiara-b-1.jpg",]
// Display the images
let imageContainer = document.createElement('div');
imageContainer.style.display = 'flex';
imageContainer.style.flexWrap = 'wrap';
imageContainer.style.justifyContent = 'space-around';
urls.forEach(url => {
let img = document.createElement('img');
img.src = url;
img.style.width = isMobile() ? 'calc(100% - 20px)' : 'calc(50% - 20px)';
img.style.height = 'auto';
img.style.margin = '10px';
imageContainer.appendChild(img);
});
// Add the image container to the DOM, right after the Generate button
document.querySelector('.btn').after(imageContainer);
}
The first image doesnt have much gap between the generate button and it? whereas the next images have enough gap between them(veritcally)
[AI]: The reason for this is that the margin for the `img` elements is only applied to the sides of each image but not between the button and the first image.
To add a gap between the button and the first image, you can add a top margin to the `imageContainer` div. Here's how you can modify your JavaScript code:
```javascript
// Existing code...
// ...
// Display the images
let imageContainer = document.createElement('div');
imageContainer.style.display = 'flex';
imageContainer.style.flexWrap = 'wrap';
imageContainer.style.justifyContent = 'space-around';
imageContainer.style.marginTop = '20px'; // Add a top margin to the image container
urls.forEach(url => {
let img = document.createElement('img');
img.src = url;
img.style.width = isMobile() ? 'calc(100% - 20px)' : 'calc(50% - 20px)';
img.style.height = 'auto';
img.style.margin = '10px';
imageContainer.appendChild(img);
});
// Add the image container to the DOM, right after the
[USER]: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>AI Image Generator</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="negative-prompt" class="form-label">Negative Prompt</label>
<textarea id="negative-prompt" class="form-control mb-3" rows="1" placeholder="Type a negative prompt..."></textarea>
</div>
<div class="input-container">
<label for="provider" class="form-label">Provider</label>
<select id="provider" class="form-control mb-3"></select>
</div>
<div class="input-container">
<label for="model" class="form-label">Model</label>
<select id="model" class="form-control mb-3"></select>
</div>
<div class="input-container">
<label for="style" class="form-label">Style</label>
<select id="style" class="form-control mb-3"></select>
</div>
<div class="input-container">
<label for="ratio" class="form-label">Aspect Ratio</label>
<select id="ratio" class="form-control mb-3"></select>
<div class="input-container">
<label for="num-images" class="form-label">Number of Images</label>
<input type="number" id="num-images" class="form-control mb-3" min="1" max="4" value="4">
</div>
</div>
<button class="btn btn-primary mt-3">Generate</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;
}