The absence of spacing in the .pug file is creating a margin conflict with Bootstrap due to elements being densely packed

One puzzling issue arises: can a space be added between the html div's created by a .pug file?

Converting HTML to Pugs has been smooth sailing for the most part, except for one hiccup. A set of buttons suddenly lost their spacing.

Upon closer inspection of both the original and generated HTML, the missing link became apparent – the absence of spaces between each button element. Adjusting this manually brought back the margins.

While it may seem like an unexpected anomaly or even a Bootstrap bug to some, I am eager to find a solution that allows me to integrate the necessary spaces into the pug file.

Below is the original HTML:

<div class="my-3 text-center" role="group">
    <button class="btn btn-primary" id="saveBtn" type="button" disabled="">Save</button>
    <button class="btn btn-danger" id="undoChangesBtn" type="button" disabled="">Undo Changes</button>
    <button class="btn btn-secondary" id="viewSignPage" type="button">View Sign Page</button>
    <button class="btn btn-secondary" id="viewDataPage" type="button">View Data Page</button>
</div>

And here is the corresponding pug code:

.my-3.text-center(role="group")
    button.btn.btn-primary#saveBtn(type="button" disabled) Save
    button.btn.btn-danger#undoChangesBtn(type="button" disabled) Undo Changes
    button.btn.btn-secondary#viewSignPage(type="button") View Sign Page
    button.btn.btn-secondary#viewDataPage(type="button") View Data Page

The resulting HTML with the spacing issue:

<div class="my-3 text-center" role="group"><button class="btn btn-primary" id="saveBtn" type="button" disabled="">Save</button><button class="btn btn-danger" id="undoChangesBtn" type="button" disabled="">Undo Changes</button><button class="btn btn-secondary" id="viewSignPage" type="button">View Sign Page </button><button class="btn btn-secondary" id="viewDataPage" type="button">View Data Page</button></div>

Answer №1

Discover a straightforward solution by adding a margin class to every button. See below for the updated formatting of the buttons in pug:

button.btn.btn-primary.m-1#saveBtn(type="button" disabled) Save

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

Utilize subdomain middleware to identify and connect with specific client workspaces

Creating a platform using the Node + Express stack for multiple companies requires careful consideration of data segregation. I plan to implement subdomains with each company's name in order to link requests to their specific data rather than mixing i ...

My website includes a <div> section that features both an image and a <figcaption>. However, when I attempt to apply padding to the <figcaption>, it does not seem to take effect

I've been trying to troubleshoot this code, but the padding just won't cooperate and I can't seem to figure out why. .img-caption { visibility:hidden; width:22%; height:435px; background-color:#f9f4e3; ...

Jquery's remove function fails to function correctly when used on a cloned element

I am facing an issue where I have a list of rows that need to be deleted. However, when I attempted to use jQuery's remove function, it only removed the original row and not its clone. My goal is for the parent element of the parent to be removed when ...

Is a middleware function required for Router.use?

Currently, I'm in the process of organizing my login routes by storing them in a separate JS file named login_routes.js However, an error keeps popping up that states: TypeError: Router.use() requires middleware function but got a Object at ...

Vercel seems to be having trouble detecting TypeScript or the "@types/react" package when deploying a Next.js project

Suddenly, my deployment of Next.js to Vercel has hit a snag after the latest update and is now giving me trouble for not having @types/react AND typescript installed. Seems like you're attempting to utilize TypeScript but are missing essential package ...

Nested Flexbox Elements

Looking to nest elements using flexbox in order to achieve the following layout: https://i.sstatic.net/bEKps.png Does anyone know how to make this happen? ...

Provide Chai/Mocha with a selection of essential keys that need to be incorporated

It appears that running the following code: describe( 'Add Youtube', function () { it( 'should return the video data, including user, title and content fields', function ( done ) { this.timeout( 5000 ) request({ ...

Is there a way to verify the content of a span and automatically guide the user elsewhere if it meets certain criteria?

Currently, I am facing an issue with adding Google authentication to my website as the redirect function is not working properly. As a solution, I plan to implement manual redirection using JavaScript in case the value of the span element is <span id= ...

Enhancing the smoothness of parallax scrolling

My header is going to be twice the height of the viewport. I added a simple parallax effect so that when you scroll down, it reveals the content below. However, I'm experiencing flickering in the content as I scroll, possibly due to the CSS style adju ...

Is it possible for me to insert a scope into the filter as well?

Recently, I created a task filter and I am facing an issue with editing the title text when another button is selected. I attempted to use a scope but that solution did not work. Does anyone have any suggestions or alternative solutions if the scope method ...

Hovering over an image and trying to rotate it results in

Check out my rotating image example on hover in React here This effect utilizes scale(), rotate(), and transition properties to create an animated rotation when hovering over the parent element. Additionally, overflow: hidden is applied to the parent elem ...

Using jQuery to populate tables

Here is a table I am working with: <table class="table table-hover"> <thead> <tr> <th>Person</th> <th>Ethereum Address</th> ...

What is the best way to ensure that the size of a header is balanced on both margins?

I just recently began learning CSS about a week and a half ago, and I'm facing a challenge that I'm struggling to overcome. I want my webpage to have the same design as shown in this image, but despite trying various solutions, I can't seem ...

Display the same DIV element across various HTML tabs

When two different tabs are clicked, I need to display a set of 10 Search Fields. Both tabs have the same fields, so instead of using separate DIVs, I want to use the same DIV and only change the AJAX REST End-Point based on the selected TAB. Can someone ...

Perform validation on input by monitoring checkbox changes in Angular 4

I am currently working on a project where I need to loop through an array of key values in order to create a list of checkboxes, each accompanied by a disabled input field as a sibling. The requirement is that upon checking a checkbox, the corresponding in ...

Is there a way to substitute certain values retrieved from a database within sails?

I am currently working on replacing fields in the data retrieved from a database using sails. async.waterfall( [ function getscores(callback) { Score.find({course : courseId}).paginate({page : 1 , limit: 10}).populate('course') ...

understanding the sequence of function execution in a Node.js project using JavaScript

I'm facing a challenge in removing an item from a MongoDB array within a node.js program and have come across an issue affecting the flow of program execution. Below is the snippet of code: productController.deleteProduct = function(req,res){ produ ...

Error when using ReactDOM.render with React version 16.5.2: Node not found on component that has been unmounted

After updating my ReactJS project to the latest version using npm update in Visual Studio 2017, I encountered the following results: + @material-ui/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="234a404c4d5063110d130d10">[e ...

I have a collection of dictionaries that I need to integrate into a Django application. What is the best approach for doing this?

My data structure consists of an array of dictionaries: [{'name': 'X','class':'A'},{'name':'Y','class':'B'}] I need the HTML to display as follows: Name:X, Class:A Name:Y, C ...

Issues arise with loading AngularJS directive properly within the context of service utilization

Currently, I am diving into the world of JavaScript and tackling a project that involves fetching data from MongoDB. My task is to write code in AngularJS to create a pie chart using Highcharts. Surprisingly, everything works smoothly when I solely use an ...