What is preventing the question div and buttons from expanding according to their content?

After experimenting with setting the height of the question div to auto, I found that it would stretch to fit its content. However, I am looking for a solution without overflow: auto or scroll. Is there a limit to how responsive it can be once a certain amount of content is added? When I add just one more sentence to the buttons, they expand by an additional line. Is this the maximum level of responsiveness achievable?

*{
margin: 0;
padding: 0;
}

body{
font-size: 1rem;
font-family: Arial, Helvetica, sans-serif;
}

.container{
height: 100vh;
display: flex;
justify-content: center;
text-align: center;
}

.card{
margin-top: 3rem;
height: 400px;
width: 300px;
border: 5px solid black;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}


.btn-grid{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin: 2rem;
width: 100%;
}

.button{
margin: 0.4rem;
padding: 0.6rem;
width: 60%;
border: 1px solid white;
border-radius: 12px;
height: auto;
}
<div class= "container">
<div class = "card">
<div class = "question">
<div class = "q-content">
<h2>Who broke into Bryans house?</h2>
</div>
</div>
<div id= "answer-buttons" class= "btn-grid">
<button class= "button">xxxxxxxxxxxxx</button>
<button class= "button">A homeless khlhjhk</button>
<button class= "button">kkkkkkkkkkkkkkkkkkk</button>
<button class= "button">His ex-wife</button>
</div>
<div class = "from">
<div>From Episode 312</div>
</div>
</div>
</div>

Answer №1

Consider including word-wrap: break-word; in the CSS for the .button class. This adjustment could potentially meet your desired result.

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

Is it possible to combine the :last-child pseudo-class with the universal selector (*) in CSS or Sass

Here is the code I am currently using: .loken5 * padding-right: 5px .loken5:last-child padding: 0 I am wondering if there is a way in SASS to achieve the same effect with just one '.loken5' tag for saving space. Thank you :) ...

Unusual actions exhibited by a combination of JavaScript functions

Encountering an issue with a JavaScript file containing multiple functions causing strange behavior. The Logging.js file is responsible for writing to a text file: function WriteLog(message) { var fso = new ActiveXObject("Scripting.FileSystemObject") ...

"Learn the steps to efficiently input multiple data entries with the same name from a single form into different rows within the same column of

How can I modify this form to insert four separate data entries in the same column upon submission? <form action="entry.php" method="post" > <table> <tr> <td> <input type="text" name="searchid[]" id="searchid" placeh ...

Buttons for concealment and revelation are unresponsive

I have the following code snippet for uploading an image, which is taken from a template utilizing bootstrap 2. <div class="span6"> <div class="control-group"> <label class="control-label">Imagen</label> <div cla ...

Steps for applying background color to a chosen element

Using a specific template, I have listed topics in the following way: //Template used for topic list display %li.topic{:topic_slug => "<%=topic.slug%>", :topic_name =>"<%=topic.text%>"} %a{href: "#!/topics/<%=topic.slug%>" } <%= ...

Blending an HTML jQuery toggle

Is there a way to make the current headline fade out while simultaneously fading in a new one when switching to the next div using a jQuery .html switch? Check out the codepen example: https://codepen.io/balke/pen/JpNNve $(window).scroll(function() { ...

Pressing a button triggers the highlighting of a tab in HTML through the use of Javascript

In the corner of my webpage, I have three tabs: info, question, order. When I click on one tab header, only that tab should highlight. The info section includes two buttons that link to the question and order tabs. When these buttons are pressed, the respe ...

Retrieve the ID of the image element using Jquery from a collection of images within a div container

I'm encountering a simple issue that I can't seem to solve. I am working on a basic slider/gallery with the following functionalities: 1) "If button 1 is clicked, image one will appear." 2) "Clicking on button 2 will make IMAGE 1 slide left and I ...

What is the process for retrieving the search function value in Node Js?

I have been working on creating a search bar functionality using the Express Framework in Node.JS, Handlebars, and MySQL. The connection to MySQL is all set up and functioning properly, I have installed body parser, and even tested the query directly in ph ...

Unable to Display Bootstrap 4 Navbar on Hamburger Menu

I am having an issue with my mobile-sized site. Whenever I click the hamburger menu, the Navbar does not appear. I have double-checked and my data-target matches the nav id, so I am not sure why it is not working. <section id="nav"> <na ...

Implementing image change on dropdown selection using jQuery click event

I'm new to Jquery and JavaScript. I have a dropdown in my Keen template that displays 2 flags. I want to be able to click on the dropdown and select the corresponding flag. Most of the examples I found online use the select and options tags, but my co ...

A fragmented rendering of a gallery featuring a CSS dropdown menu

Hey there! I'm a newbie coder seeking some assistance. Recently, I stumbled upon a tutorial online that taught me how to create a drop-down menu. However, whenever I hover over "Gallery" on my website, things go haywire and the layout gets all messed ...

Locate all elements containing a specific text string

In an attempt to clean up html-elements, I am searching for specific text strings within 2376 html-documents. The documents have varying doctype standards, with some lacking a doctype altogether (which may not be relevant). I am specifically looking for t ...

Incorporating fresh components and newly defined attributes in Angular

Is there a way for me to click on a new component button, specify a name, description, select type, and add attributes such as default value and type? I need all this information to be saved and for the new button to appear in the drag-and-drop section. ...

Troubleshooting: CSS border-radius issue with embedded iframe

I am struggling to embed an iframe from my Blogger site into a specific section on my website and round its corners using CSS. I followed a tutorial that suggested using overflow: hidden;, but for some reason, it's not working in my case - see the ima ...

When using @RestController in the following code, the HTML file is not being returned properly in the REST API. Instead, only the file name such as 'index' is displayed on the screen

Having trouble getting the HTML file to return in the Rest API. Only returning the file name like 'index' when using @RestController, but works fine with @Controller. I am working on a Spring Boot REST application and utilizing index.html with Bo ...

Display a snippet of each employee's biography along with a "Read More" button that will expand the content using Bootstrap, allowing users to learn more about each team

I have successfully developed a Google App Script that links to a Google Sheet serving as a database. The application iterates through each row, and I showcase each column as part of an employee bio page entry. ex. Picture | Name | Title | Phone | Email ...

The dimensions of the cards adjust automatically when the flex direction is set to row

My cards, created in CSS and React.js, have a set height and width. However, when I change the flex direction from column to row, the cards automatically shrink in size. Why is this happening? Card's CSS and JS code CSS .card{ height: 50%; w ...

Is the Pure CSS hide/show technique using radio buttons causing a challenge with parent and descendant elements?

Exploring a CSS Show/Hide functionality using radio buttons is my current challenge. The snippet below demonstrates how smoothly it works. .refusal, .acceptance { display: none; } input#refusal:checked~.refusal { display: block; } input#acceptanc ...

Increasing the checkout date by one day: A step-by-step guide

I am looking to extend the checkout period by adding 1 more day, ensuring that the end date is always greater than the start date. Below are my custom codes for implementing the bootstrap datepicker: $(function() { $('#datetimepicker1').da ...