Bootstrap: utilizing a layout where text appears on two lines rather than one

Hey there,

I'm currently utilizing Bootstrap 4.5 and attempting to create an aesthetically pleasing footer for my university website. I've implemented the following code:

<div class="container-fluid d-flex justify-content-center">

In order to center my footer without having the blocks spread too far apart.

However, when viewing on a larger screen (I tested this using Firefox), the text appears on two lines due to the centered alignment, whereas I'd prefer it to be on a single line to make better use of the available space: https://i.sstatic.net/SlGuf.png

If you need it for reference, here's the complete code:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fe9c91918a8d8a8c9f8ebecad0cbd0cd">[email protected]</a>/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<div class="container-fluid d-flex justify-content-center">
    <div class="row">
    
        <div class="col-lg-4 col-md-6 col-12 pb-5">
            <h4 class="text-center">some text</h4>
            
            <div class="d-flex justify-content-between align-items-center">
                <a href="#" data-toggle="collapse" data-target="#footer_ups" aria-expanded="false" aria-controls="footer_ups">
                    <span><i class="fa fa-chevron-right pr-2"></i>some text some text sometext sometextsome text</span>
                </a>
                <span class="badge badge-primary badge-pill">7 <i class="fa fa-caret-down"></i></span>
            </div>
            
            <div id="footer_ups" class="collapse pl-3" aria-labelledby="some text">
                <ul class="list-unstyled">
                    <li><i class="fa fa-angle-right pr-2"></i> <a href="" alt="" target="_blank">some text</a></li>
                    <li><i class="fa fa-angle-right pr-2"></i> <a href="" alt="" target="_blank">some text</a></li>
                    <li><i class="fa fa-angle-right pr-2"></i> <a href="" alt="" target="_blank">some text</a></li>
                </ul>
            </div>
            
            <div class="d-flex justify-content-between align-items-center">
                <a href="#" data-toggle="collapse" data-target="#footer_ipp" aria-expanded="false" aria-controls="footer_ipp">
                    <span><i class="fa fa-chevron-right pr-2"></i>some text sometextsome text</span>
                </a>
                <span class="badge badge-primary badge-pill">4 <i class="footer_ipp_glyph fa fa-caret-down"></i></span>
            </div>
            
            <div id="footer_ipp" class="collapse pl-3" aria-labelledby="some text">
                <ul class="list-unstyled">
                    <li><i class="fa fa-angle-right pr-2"></i> <a href="" alt="" target="_blank">some text</a></li>
                    <li><i class="fa fa-angle-right pr-2"></i> <a href="" alt="" target="_blank">some text</a></li>
                    <li><i class="fa fa-angle-right pr-2"></i> <a href="" alt="" target="_blank">some text</a></li>
                </ul>
            </div>
            
            <br />
            <i class="fa fa-chevron-right pr-2"></i><a href="" target="_blank">some textsome textsome textsome texttextsome textsome text</a>
        </div>
        
        
        <div class="col-lg-4 col-md-6 col-12 pb-4">
            <h4 class="text-center">Aide et Informations l&eacute;gales</h4>
            <ul class="list-unstyled">
                <li><i class="fa fa-angle-right pr-2"></i> <a href="" alt="" target="_blank">some text</a></li>
                <li><i class="fa fa-angle-right pr-2"></i> <a href="" alt="" target="_blank">some text</a></li>
                <li><i class="fa fa-angle-right pr-2"></i> <a href="" alt="" target="_blank">some text</a></li>
                <li><i class="fa fa-angle-right pr-2"></i> <a href="" alt="" target="_blank">some text</a></li>
            </ul>
        </div>
        
        <div class="col-lg-4 col-md-12 text-center">
            <h4 class="text-center">Suivez-nous</h4>
            
            <a href="" target="_blank"><i class="fa fa-facebook-square fa-3x mr-3"></i></a>
            <a href="" alt="" target="_blank"><i class="fa fa-twitter-square fa-3x mr-3"></i></a>
            <a href="" alt="" target="_blank"><i class="fa fa-linkedin-square fa-3x mr-3"></i></a>
            <a href="" alt="" target="_blank"><i class="fa fa-instagram fa-3x"></i></a>
        </div>
        
    </div>
</div>

Do you think it's feasible to achieve this?

Thanks in advance!

Answer №1

Attempting to condense two lines of text into one utilizing the predefined Bootstrap class col- for adjusting width is not achievable. Your text will be truncated in the process. The only way this can be accomplished is by refraining from using Bootstrap classes and assigning custom widths to all columns instead.

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

Updating a text input's placeholder using Bootstrap4

Bootstrap 4 provides classes like text-left and text-right for aligning text inside an input field. Is there a Bootstrap-friendly method to only align the placeholder text in an input without affecting the alignment of the actual text? ...

Manipulating elements repeatedly using jQuery

One of the issues I encountered while working with jQuery was appending a YouTube video when a button is clicked. To do this, I used the following code: onclick="$('#videogallery').append('<iframe width=725 height=398 src=http://www.yout ...

Trying to resolve w3 validator error and warning issues

While checking my HTML code using the W3 validator, I encountered an error and warning message: Line 21, Column 23: The ID menuItem was first used here. <li id="menuItem"><a href="#visit">Ten Places to Visit</a></li> ✉ Line 29 ...

Enhancing user input with multiple values in a textarea using JSTL

I'm having trouble inputting multiple values into a textarea using JSTL. Here is the coding snippet I am using: <label>Resources</label> : <c:forEach items="${MEETING_ENTITY}" var="resource"> <textarea id ...

Leveraging the capabilities of the phonegap framework alongside node.js, javascript, html, mysql, and css

Could someone demonstrate how to utilize phonegap and node.js to interact with a mySQL database by pushing and pulling data from an HTML page or form? THANKS EDIT var connection = mysql.createConnection({ host : 'localhost', user : 'root& ...

Different Line Thickness in Dropdown Menu

Is there a way to adjust line heights in CSS within a drop down menu? I have attempted to change the font sizes of each element, but the new font size does not seem to take effect once an option is selected. Any suggestions would be greatly appreciated! & ...

Challenge with Responsive Design

I'm struggling with implementing a responsive design for the first time. When I check the site on my iPhone, everything appears to be zoomed in for some reason. My goal is to have the logo aligned to the left within the '.container' when v ...

Position the Bootstrap footer element at the bottom of the page

On a custom HTML page that I created, I decided to include a footer using Bootstrap. In this example, it demonstrates how the footer can be positioned at the bottom of the page without being placed inside a container element (directly within the body eleme ...

Element in SwipeableDrawer of Material UI is repositioned on mobile devices while scrolling

Utilizing Material UI's SwipeableDrawer component, I have successfully created a bottom drawer with a fixed action button container. The container is positioned using position: fixed; bottom: 0;. While this setup works effectively on desktop browsers, ...

Utilizing a JavaScript variable within an HTML style attribute value

I have added some divs to a webpage. I am looking to adjust the width of these divs based on the browser or other settings. While I can manually set the width to 200px using inline styles, I need the flexibility to change it to 220px, 230px, or 240px depen ...

The .ogv video file type does not seem to be functioning properly within the HTML5 video tag on Firefox

Hello, I'm encountering some issues with playing the .ogv file in Firefox. If you could take a look at the link , that would be greatly appreciated. I believe my HTML5 video tag syntax is correct as it's working fine on other browsers. Thank you ...

Using Ajax to dynamically load page content into a div based on a selection made in a

How can I dynamically load content into a div using Ajax based on the selection made in a dropdown menu? For example, I have a select box with two options: test.HTML and test1.HTML. Below that, there is a div where I want to display the content from eithe ...

Menu Selector on the Right Side

I am currently working on a drop down menu and trying to align it to the right using HTML and CSS. Below is an example that I have been referencing: http://codepen.io/anon/pen/RNLmvq Attached here is a screenshot of how the menu appears without the text ...

Customizing the navbar to be inverse on each webpage using CSS, PHP, and Bootstrap

Dealing with a Bootstrap navbar across multiple pages on my website is becoming a hassle. Every time I need to make a change, I find myself jumping from one page to another just to update it. My objective is to have the ability to edit the navbar in one ce ...

The default margin of an HTML element is set to fill the width of its containing div and cannot be overridden

As a budding web developer, I'm encountering a basic issue that has me scratching my head. Any assistance would be highly appreciated: Regardless of the width I specify for elements within a particular div container, both Safari and Chrome seem to au ...

Is it better to use $("#myElement").length or !$("myElement") for checking the existence of the DOM element?

Is it necessary to use the length property when checking if a specific DOM element exists or not? I have seen suggestions from other posts recommending the use of the length property for this purpose, and it seems to work as expected. However, I have also ...

Is there a way to automatically scroll to the last dynamically added div?

Within the chat.html file, I have included a div tag and implemented a script that dynamically adds rows to the div when a button is clicked. In another file named list.html, I have inserted an iframe tag with the src attribute pointing to chat.html. Howev ...

Ways to eliminate the lower boundary of Input text

Currently, I am working on a project using Angular2 with Materialize. I have customized the style for the text input, but I am facing an issue where I can't remove the bottom line when the user selects the input field. You can view the red line in t ...

Tips for implementing Animation.css in Angular version 1.5.8

I have successfully added the ngAnimate dependency to my AngularJS project: var app=angular.module('testApp',['ngRoute', 'ngAnimate']); I have also included the animation classes in my animation.css file: .slide-animation.n ...

The menu using sprites does not function properly when placed within a fixed position div

On this platform, I've discovered a slew of valuable resources for creating a fixed position menu and a sprite based rollover menu. Nevertheless, I'm encountering difficulties when attempting to merge the two together. Despite my best efforts, I ...