Guide to aligning elements to the left within a container-fluid in bootstrap 4

Is it possible to align the text in Line 1 and Line 2 to the left without any gap appearing on the left side of line 2, regardless of the device size?

I have attempted to use various methods such as m-1, p-1, text-left, and even negative padding, but none of them seem to eliminate the space before line 2. Any suggestions would be greatly appreciated.

Here is a JSFiddle link containing the code related to this issue

<h4>Line 1 - Header4 </h4>
<div class="container-fluid">
   <h4> Line 2 - Header4 </h4>  <!-- THE ISSUE IS HERE -->
   <div class="row zz-border-Top2 
      border-bottom border-primary text-center bg-light">
      <div class="col-sm-1 font-weight-bold text-dark bg-warning">
         <h6>Text 1</h6>
      </div>
      <div class="col-sm-2">
         <h6> Text 2 </h6>
      </div>
      <div class="col-sm-9 text-left" style="color:navy;">
         <h6>Text 3</h6>
      </div>
   </div>
</div>

Answer №1

To properly align your content, make sure to nest the row element inside the container and adjust the padding by utilizing the negative margin of the row.

<link rel="stylesheet" type="text/css" href="//stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<h4>Line 1-Header4 </h4>
<div class="container-fluid">
  <div class="row">
   <h4> Line2-Header4 </h4>  <!-- HERE IS THE ISSUE -->
  </div>
   <div class="row zz-border-Top2 
      border-bottom border-primary text-center bg-light">
      <div class="col-sm-1 font-weight-bold text-dark bg-warning">
         <h6>Text1</h6>
      </div>
      <div class="col-sm-2">
         <h6> Text 2 </h6>
      </div>
      <div class="col-sm-9 text-left" style="color:navy;">
         <h6>Text 3</h6>
      </div>
   </div>
</div>

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

Displaying JSON data with dynamic color changes in an HTML table: A comprehensive guide

Scenario: I am currently working on a project where I need to fetch data from an external json file, parse it, and then dynamically add it to an HTML table using the footable jQuery plugin. Question: I have a query regarding how to use JavaScript to parse ...

Maximizing CSS opacity for optimal performance in image fading

I'm working on creating a smooth fade in-out effect for the images in my photo gallery by adjusting the CSS opacity value using JavaScript. However, I've noticed that this process is quite sluggish on certain computers, such as my relatively new ...

What is the best way to display the user login in the center of a page with all necessary controls

Challenge How can the user login be displayed in the center of the page? Additional Information The current layout displays user login data on the left-hand side. I am looking to have the user login data centralized on the page, which includes labels f ...

Ways to display and conceal menu depending on initial view and scrolling

On my website, I have implemented two menus - one to be displayed when the page loads and another to show up when a scroll occurs. You can view my page here. The goal is to have the white part visible when the position is at the top, and switch to the blu ...

Python Selenium: Strategies for Iteratively Waiting for a Clickable Element

My task involves downloading images from website pages using Python Selenium. I need to select the web elements of these images and click on them one by one: ... THUMBNAILS = browser.find_elements_by_xpath("//div[contains(@class, 'lg-thumb-item&a ...

How can I effectively access and view HTML files within VSCode while utilizing WSL?

Has anyone else experienced issues with the open-in-browser extension? Whenever I try to open my HTML file for a project, it doesn't load in the browser. I've attempted storing my repository in different directories on Linux and even in a folder ...

What is the best way to align a center column of a precise width that is responsive to different screen

As much as I hate to ask for help with a "how do I do this" question, I'm at my wit's end trying to figure it out on my own. I'm working on a page layout that requires a center column of exactly 960px width to be horizontally centered on th ...

Switch between showing and hiding a div by clicking on the panel header and changing the symbol from + to

I need assistance with a panel feature on my website. The panel should expand when the "+" symbol is clicked, displaying the panel body, and the "+" symbol should change to "-" indicating it can be collapsed by clicking it again. There is a slight twist t ...

Invoke the Bootstrap function from a webpage

I am attempting to call an AngularJS function, but I keep receiving an error that says "Cannot read property 'forget' of undefined." Can someone please help me resolve this issue? Below is the JavaScript code I am using: var rootApp = angular.m ...

Contrasting border with border-style

To eliminate all borders from my primefaces panelgrid component, I employ the following techniques: First method: .table, table td { border-style: hidden !important; } Second method: .table, table tr, table td { border: none !important; } Can ...

Using jQuery and AJAX to submit a dynamic form

I am currently facing an issue with cloning a HTML drop down list using jQuery. The main problem I am encountering is that there seems to be no restriction on the number of cloned sections, and I need to store all these sections in a mySQL database. How c ...

Stroke on SVG Rect disappears suddenly without explanation

My rectangle seems to be losing some of its stroke randomly, sometimes after around 50 seconds. I can't figure out why this is happening, could you help me out? Here is the link to the fiddle - http://jsfiddle.net/nhe613kt/368/ Below is the relevant ...

Issue with Jquery Fatnav - active state not functioning properly

Currently, I am implementing a Jquery plugin known as fatNav. The documentation for the plugin can be found here: https://github.com/Glitchbone/jquery-fatNav Although everything is functioning properly, I am encountering difficulty getting my active stat ...

What is the best way to trigger an event function again once a specific condition has been satisfied?

I'm currently working on a project where I need a sidebar to scroll at a slower rate until it reaches a specific point, and then stop scrolling once that point is reached. Below is the jQuery code I've been using: $(window).on("scroll", function ...

Adjusting the size of div content without changing its dimensions

I'm in search of a solution for resizing the contents within a fixed width and height div. Currently, my div looks like this: <div id="editor_preview" style="width:360px !important; color:gray; ...

The Vue instance methods provide a way to access and manipulate formatted properties

I am looking to implement a method that will generate the appropriate email format to be used as the href value in an anchor tag. This method should return the formatted string in the following format: "mailto:[email protected]". var facultyInformat ...

Button in HTML not responsive to clicks

I'm facing an issue with my HTML button as it's not clickable at all. I suspect it may be related to incorrect div settings or a background issue. Can someone advise on what setting needs to be changed for the "sign the petition" link to become ...

center the radio button with CSS3

I am experiencing difficulty focusing the pointer inside this customized radio button. <div class="radio"> <input id="left" type="radio" name="gender" value="left"> <label for="left">Left</label> <input id="right" ty ...

Creating a cohesive In-Line Navbar Form with Bootstrap 4

Currently, I have designed a navigation bar using Bootstrap 4. My aim is to incorporate the search bar in line with the navigation bar. I have applied the 'form-inline' class to the search form, however, the search button still appears below the ...

When employing autoForm in Bootstrap 4, where is the "form-control" class established?

Currently, I am working on developing a personalized autocomplete type feature for the afQuickfield in my Meteor project. The main issue I am facing is that when I specify the type="autocomplete" on the afQuickfield, the class="form-control& ...