Utilizing White-space in Bootstrap 4

I've searched extensively for a bootstrap alternative to the CSS property

"white-space: break-spaces"
, but it seems elusive.

The issue I'm facing is that in the mobile view, the button extends beyond the screen due to the lengthy text within it.

Here's the button code:

<button class="btn btn-primary mt-3" id="send_sms_btn" type="submit">Verify &amp; Submit Withdrawal</button>

While applying the CSS property directly to the element solves the problem, I am restricted to using only Bootstrap. Any recommendations?

Answer №1

One way to address this issue is by applying the .text-break class to the button element.

<button class="btn btn-primary mt-3 text-break" id="send_sms_btn" type="submit">Verify &amp; Submit Withdrawal</button>

For more information on text breaks, click here

Answer №2

<style>    
button.wrap {
          white-space: nowrap; 
          width: 100%; 
          overflow: hidden;
          text-overflow: ellipsis; 
          border: 1px solid #000000;
}
</style>

Insert the above style into your css file or within the head tag of your HTML document.

 <button class="btn btn-primary mt-3 wrap" id="send_sms_btn" type="submit">Verify &amp; Submit with an excessively long text that wraps nicely</button>

Apply the wrap class to your button element in order to prevent it from going off-screen. Give it a try and hopefully this will resolve the issue.

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

No adjustment in color upon switching themes

I've been struggling to achieve the desired outcome while working on a small coding task. The goal is to modify the color of the screen background, text, and button as illustrated in the uploaded image. I have three code files for this task - index, t ...

Why is my navbar not functioning properly with Bootstrap 5 and HTML?

My navigation bar suddenly stopped working and now my background image, text on the background image, and navigation have all turned white after I added links to different hrefs. I'm also using bootstrap 5. The only thing I can see is from my id citat ...

There was an issue compiling the file static/css/main.b6d8a2cb.css with the Css Minimizer plugin. An error occurred: TypeError - Unable to modify properties of undefined (setting 'value')

PS C:\Users\Hp\Desktop\web technology\NCT\carrental> npm run build [email protected] build react-scripts build Attempting to generate an optimized production build... Compilation failed. The error message "static/c ...

How to create a stylish border line to separate rows using CSS

Having some trouble with HTML code... <table class="table table-condensed order-statistics"> <tr class="order-statistics-row"> <div class="row"> <div class="col-lg-4"> Order ID: </div> <div ...

Creating an array using Vue.js

When I initialize a Vue data array like this [0: Object, 2: Object];, the console log in Vue shows the array as [0: Object, 1: undefined 2: Object];. This causes issues when iterating through with 'v-for="cell in row.cells"' as it results in tryi ...

Was unable to maintain the default state of the button as clicked

When the website loads, I expected the navbar to have a certain design. However, I encountered an issue where I couldn't set the button's state as clicked. If you are curious about the output I achieved, you can watch it in video format here: H ...

Erase the Japanese content from the input

Having trouble removing Japanese characters from a text input box using jQuery. Here is the code I am trying: $('#email').keyup(function () { this.value = $(this).val().replace(/[^a-zA-Z0-9!.@#$%^&*()_-]/g,''); }); // try &l ...

Set the <img> source to link to a PHP webpage

I store all my images in a secure directory inaccessible to normal users. The filenames are generated randomly, so I want to keep the path and names of the files hidden. Currently, my img element looks like this: <img src="get_image.php?id=1"> This ...

Center two elements within a div container both horizontally and vertically

I am trying to vertically center a text and a button within a container. The text should be positioned in the middle of the div, while the button should be aligned to the right. What is the best way to achieve this layout where the text element is centere ...

I am having trouble getting my textarea to accept width attributes

Strangely, the text area on my website just won't cooperate with the width I specify. I've double-checked the CSS multiple times to no avail! Take a look at this jsfiddle example that demonstrates what I'm trying to achieve. However, on my ...

What steps can be taken to design a unique CSS pop-up that triggers upon page load, limited to one appearance per visitor every week

I have the following code snippet that allows me to display a pop-up either by clicking on the link or hovering over it. I am looking to modify it so that the pop-up opens when the page loads and restrict it to open only once per visitor per week. As some ...

To ensure proper loading of Bootstrap assets, it is necessary to place the assets folder within the public

Currently, I am embarking on a React project that incorporates Bootstrap components. To streamline my workflow, I have decided to utilize an assets folder sourced from BootstrapMade.com Initially, the bootstrap functions seamlessly when I import the asse ...

Looking to update properties for elements within the Angular Material 16 mat-menu across the board?

Currently working with Angular Material 16 and I have a question regarding the height of buttons inside the mat-menu element. Here is an example of the code: <button mat-icon-button> <mat-icon>more_vert</mat-icon> </button> ...

Difficulty displaying background image on iOS devices like iPhone and iPad

Our Magento website has a background image that expands according to the content, working well on PCs and Macs. However, the white background does not show up on iOS devices. I have attached two screenshots - one showing how it appears on a regular PC bro ...

Modifying an image in a particular row of a table generated using the *ngFor loop in Angular

Currently, I am working on a table generated by ngFor. Each row in the table contains a button with an image as its background: <tbody> <tr *ngFor='let movie of movies let i = index'> <td>...some values here. ...

How can you vertically center an icon button in Material UI?

Looking for help with aligning elements in this code snippet: <TextField id="outlined-basic" label="22Keyword" defaultValue={"test123"} variant="outlined" /> <IconButton aria-label="delete&q ...

How to Place Content Below a Fixed Navigation Bar?

Is there a way to insert content below a fixed navigation bar without relying on the margin-top property? Any alternative solutions? I experimented with position: relative and the top property, but I'm looking for a different approach. ...

Is there a way to retrieve the present value of a dropdown menu once an ajax call is successful?

Currently, I am facing an issue where I am unable to retrieve the selected value from a dropdown menu. The logged value is always the first option in the dropdown menu, even though I have set it to a different value. Can someone help me identify what I may ...

Display user input within a modal dialogue box

I have a subscription form that requires users to enter their name and email address. After clicking on "Compete Now," a pop-up appears asking for workshop information and postal code. The form is functioning correctly as intended. However, I want the em ...

Discovering the Nearest Textfield Value Upon Checkbox Selection Using JQuery

How can I retrieve the value of the nearest Textfield after selecting a checkbox? This HTML snippet serves as a simple example. In my actual project, I have dynamically generated lists with multiple checkboxes. I require a way to associate each checkbox wi ...