Struggling with resizing my card height in bootstrap

<div class="card border-dark bg-white text-dark" style="width: 400px; height: auto; margin :10px auto ">
        <div class="card-header">
            <h3>Sign up for our Services</h3>
        </div>
        <div class="card-body">
            <form action="/signup" method="post">
                <div class="mb-3">
                    <input autocomplete="off" autofocus type="text" class="form-control" name="email" placeholder="Email">
                </div>
                {% if email_error %}
                    <div class="alert alert-danger" role="alert">
                    {{ email_error }}
                    </div>
                {% endif %}
                <div class="mb-3">
                    <input type="password" class="form-control" name="password" placeholder="Password">
                </div>
                {% if password_error %}
                    <div class="alert alert-danger" role="alert">
                    {{ password_error }}
                    </div>
                {% endif %}
                <div class="mb-3">
                    <input type="password" class="form-control" name="confirm_password" placeholder="Confirm Password">
                </div>
                {% if confirm_password_error %}
                    <div class="alert alert-danger" role="alert">
                    {{ confirm_password_error}}
                    </div>
                {% endif %}
                <div class="col text-center">
                    <button type="submit" class="btn btn-primary">Sign Up</button>
                </div>
            </form>
        </div>
    </div>

https://i.sstatic.net/pBHbJc7f.png

I am in the process of developing a sign-up form using card properties from bootstrap. However, I encountered an issue where the card's height is filling up the entire screen.

Various attempts were made to adjust the height by setting it as 'auto' on both the parent and child elements, but the problem persists.

Answer №1

Resolution: eliminate the card-body section

 style="height:300px"

Answer №2

To achieve this layout, I recommend using a combination of utility classes and a custom maximum-height style. More specifically, you can apply the vh-100 class to make it take up 100% of the horizontal viewport, while also adding "maximum-height:400px" in the style tag to set a limit at 400 pixels.

Simply update your card tag as follows:

<div class="card border-dark bg-white text-dark w-50 vh-100" style="max-height:400px" >

Answer №3

After incorporating the fit-content property into the CSS rule, the height of the element adjusted itself effortlessly!

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

Techniques for Adding Background Color to Fieldset Border

Recently starting to learn HTML and stumbled upon a question: How can I create a background color or image for a field set border? Can I simply use regular color values, or do I need special codes for creating a background color in a field set? Any insig ...

Utilizing jQuery .load() for dynamic content updates with a smooth back/forward button functionality

My website uses a custom jQuery script to load content seamlessly without refreshing the page, but I am facing an issue with the back/forward buttons. The loading is based on hash links in my PHP files. .... <li><a id="theShopLink" class ...

Which specific html container or element can be found on the mymsn pages?

When accessing mymsn, users have the ability to personalize the content and layout of their webpage. I am curious about what type of container is being utilized for this customization - does it involve an html element, or perhaps javascript, or something e ...

Can you tell me the proper term for the element that allows CSS properties to be changed after a link has been clicked?

I have integrated a horizontal scrolling date selector on my website, and it is functioning well. However, I am facing an issue while trying to change the CSS properties of a clicked date link using jQuery. Despite successfully firing the click event, I am ...

Manipulating the size of the Chrome viewport manually yields varying outcomes compared to resizing within the browser using the "Inspect" tool

I'm currently working on developing a responsive custom theme for Wordpress. I have it hosted locally using WAMP and employing different tools to ensure it is mobile-friendly. However, I am encountering inconsistencies in the results, especially since ...

Searching the database using an ID in Django

In my Django project, I have the following Model: class Choices(models.Model): question = models.CharField(max_length=200) option1 = models.CharField(max_length=200) option2 = models.CharField(max_length=200) option3 = models.CharField(max ...

The functionality of CSS transform appears to be malfunctioning on Firefox browser

My website, located at , features a logo that is centered within a compressed header. I achieved the centering effect using the following CSS command: .html_header_top.html_logo_center .logo { transform: translate(-63%, -2%); } This setup works perfe ...

Loop through an array using a 'while' loop

Can anyone help me with this coding issue? I am having trouble inserting a modified date into a table within a switch statement. When I try to add the date into the table, it doesn't work, even though when I set a variable like $x = "15:06", it works ...

Create interactive buttons for HTML code that is generated dynamically

In the process of developing an ASP.NET WebForms application, I am dynamically creating the HTML content for a Bootstrap timeline based on the data fetched from a SQL query. My goal is to incorporate both delete and modify buttons for each entry, allowing ...

Show the image in its original form using the Transform feature

What is the best way to use CSS transform to achieve the same look as the image in the 2nd link? I tried skewY for the first image but it's not quite what I'm going for. https://i.sstatic.net/teV9e.jpg https://i.sstatic.net/m0vsh.jpg ...

if jade is being inconsistent

I am currently using expressjs in my app and have the following setup: app.get('/profile',index.profile); app.get('/',index.home); Within layout.jade, I have the following code: ... if typeof(username)!=='undefined' ...

What is the process for extracting specific text from a web page source using Python with Selenium?

The following is the HTML source code: <div class="dropdown-popup"> <a href="/integrations/sources/" class="dropdown-item">Sources</a> <a href="/integrations/destinations/" cla ...

What is the best way to attach a CSS class using an onclick function?

I need to dynamically apply a CSS class to a specific div when clicked using JavaScript. Here is the HTML structure: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv=&qu ...

Is it necessary for children to occupy the same area while beginning from the coordinates 0, 0?

Imagine a scenario where you have a modal with tabs and tab content. Each tab has a different height - the first tab is 100px high, the second tab is 500px high, and the third tab is 50px high. The challenge here is to ensure that the modal body always mat ...

Vertical centering menu adjustment

Can anyone help me with centering an image on my website? I've tried the following code: top: 50%; -webkit-transform: translateY(-50%); -ms-transform: translateY(-50%); transform: translateY(-50%); You can see what's happening on my site here: ...

Is it possible to adjust the left property following the concealment of an element with JQuery?

My goal is to move an image element using the 'left' property after hiding a div. To achieve this, I am using JQuery's '.promise()' function. Here is my code: HTML code: <div id="outerContainer"> <div id=" ...

Determine the exact location where the mouse was clicked on a webpage containing an iframe

I am trying to retrieve the mouse position on my HTML page, but I am encountering some issues. Here's what I have so far: document.onclick = function(click) { if (click.clientX<340){ myControl.inputs.selection = false; btnRotate.remove ...

How can I prevent emailjs from submitting empty fields in an HTML form?

I recently created a form with an onclick event that triggers the submission of the form even if it's empty. Here is an example: <form> <div class="form-item"> <label for="date">Date:</label> ...

Discovering JSON data embedded within a script tag in an HTML response using Jsoup

Looking for help with extracting JSON content from script tags embedded in an HTML file. I attempted to use Jsoup without success. Can anyone provide guidance on utilizing JSOUP or another library for this task? Thank you in advance. ...

Is there a way to shift the text to a new line within a JLabel without using HTML?

To create a line break in the text of a JLabel without using HTML, you can use the following method: JLabel label = new JLabel("Line\nNext line"); Is there a way to achieve this without relying on HTML? Thank you! ...