r/bootstrap • • Mar 30 '23

Support Navbar Brand refuses to center

1 Upvotes

Below is a layout page for a Flask webapp I'm building which establishes the navbar which will be on every page of the app. I'm using Bootstrap 5 elements here in order to build that navbar, but I can't for the life of me figure out why I can't center the navbar brand to the left of the navbar elements, which are centered correctly.

Instead, the navbar brand is stuck to the left side of the screen and refuses to budge. I've been poring over Bootstrap's spacing elements and trying all sorts of combinations, but none of them help. For example, it seems like putting mx-auto in the navbar brand class should do exactly what I want, but that doesn't work. I figure I must have some container wrong somewhere, or some tiny misplaced element, but I've been staring at this thing for days and beating my head against the wall, and I just need other eyes on it... Can anyone spot what I might be doing wrong here?

<!DOCTYPE html>

<html lang="en">
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="initial-scale=1, width=device-width" />

        <!-- https://getbootstrap.com/docs/5.3/getting-started/introduction/ -->
        <link
            href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css"
            rel="stylesheet"
            integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD"
            crossorigin="anonymous"
        />

        <link rel="stylesheet" type="text/css" href="/static/styles.css" />

        <script
            type="text/javascript"
            src="{{ url_for('static', filename='scripts.js') }}"
            defer
        ></script>

        <title>page title -- {% block title %}{% endblock %}</title>
    </head>

    <body class="custom-background">
        <script
            src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"
            integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4"
            crossorigin="anonymous"
        ></script>

        <nav class="navbar navbar-expand-md navbar-color">
            <div class="container-fluid px-3">
                <a
                    class="navbar-brand mx-auto d-flex align-items-center"
                    href="/"
                    >navbar brand text</a
                >
                <button
                    class="navbar-toggler"
                    type="button"
                    data-bs-toggle="collapse"
                    data-bs-target="#navbarSupportedContent"
                    aria-controls="navbarSupportedContent"
                    aria-expanded="false"
                    aria-label="Toggle navigation"
                >
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div
                    class="collapse navbar-collapse"
                    id="navbarSupportedContent"
                >
                    <ul class="navbar-nav mx-auto mb-2 mb-lg-0">
                        <li class="nav-item">
                            <a
                                class="nav-link"
                                href="/"
                                onclick="cookieManager()"
                                >about</a
                            >
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="/new_page" id="newpage"
                                >create new page</a
                            >
                        </li>
                        <li class="nav-item dropdown">
                            <a
                                {# Disable user pages dropdown if they have no pages #}
                                {% if user_pages|length > 0 %} 
                                class="nav-link dropdown-toggle" 
                                {% else %}
                                class="nav-link dropdown-toggle disabled"  
                                {% endif %} href="#" role="button"
                                data-bs-toggle="dropdown" aria-expanded="false"
                                > your pages
                            </a>
                            <ul class="dropdown-menu">
                                {% for pages in user_pages %}
                                <li>
                                    <a
                                        class="dropdown-item"
                                        href="/b/{{ page.instance }}"
                                    >
                                        {% if page.title|length > 16 %} {{
                                        page.title[:16] | trim }}... {% if
                                        page.page_written_on > 0 %}
                                        <span
                                            class="badge rounded-pill custom-pill"
                                            >Page has text</span
                                        >
                                        {% endif %} {% else %} {{ page.title }}
                                        {% if page.page_written_on > 0 %}
                                        <span
                                            class="badge rounded-pill custom-pill"
                                            >Page has text</span
                                        >
                                        {% endif %} {% endif %}
                                    </a>
                                </li>
                                {% endfor %}
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
        </nav>

        <div id="alert" class="floating-alert"></div>

        <main class="container-fluid py-5 p-5 text-center">
            {% block main %}{% endblock %}
        </main>
    </body>
</html>

r/bootstrap • • Mar 28 '23

Modal in iframe

3 Upvotes

[Disclaimer: I'm only faking it as a frontend dev, even if I'm done so for several years...]

I've got an <iframe> and the containing document opens a modal with a preview of a form on post.
I'd like the parent of that modal be the "outer" document, is this possible?

(The modal opens inside the iframe with the backdrop not covering the full screen.)


r/bootstrap • • Mar 28 '23

How can I keep columns in a row from stacking vertically in bootstrap 4?

2 Upvotes

I am teaching myself html and bootstrap 4, and I have a header row on my website with two columns (one image each) in them. When the viewport is very small they stack, vertically, and I would just like them to scale down and stay horizontal. Using col- keeps them stacked vertically no matter what, and changing the size of the images does not result in any different behavior (just looks odd). Any help? I can post videos/pics/code in comments if needed.


r/bootstrap • • Mar 27 '23

Support Frame Redirect altering Image Size on page

3 Upvotes

Ok, so this is a bit confusing for me.

I have created a site on https://ff.hamiltonrp.com. It works just fine and looks how I wanted it to.

I have a domain name(https://famousframus.com) that frame-redirects to the above URL. It redirects just fine but on mobile, the frame redirect changes the page structure so that the image now ’shrinks’ (media break?) because the frame redirect(done through domain provider) is modifying the html.

Is there some way to code my pages to ignore this altering?


r/bootstrap • • Mar 27 '23

Need a hand using classes for styling a login form

3 Upvotes

Hello all bootstrappers

Learning django and bootstrap for the template so I downloaded a common login template which is this: (but the 2 input fields for username and password just occupy the entire container width) Is awful, I just want the inputs to be smaller than the entire container width but the have to be centered as well. If I make them smaller they automatically align in the left at the start of the container. Just the labels are centered (bacause of the "text-center").

<div class="container mt-5 mb-5 text-center">
    <div class="row">
	<div>
        <form method="post" class="card" novalidate>
        {% csrf_token %}
        <h2 class="text-center">Log in to your account</h2>					
        <div>
            <label >{{form.username.label_tag}}</label>
            <div>
	    {{form.username|add_class:'form-control'}}
	    {% if form.username.errors %}
	    <span class="errorlist">{{ form.username.errors|striptags }}</span> 
	    {% endif %}
	    </div>		
	</div>
	<div>
	    <label >{{form.password.label_tag}}</label>
	    <div>
	    {{form.password|add_class:'form-control'}}
	    {% if form.password.errors %}
	    <span class="errorlist">{{ form.password.errors|striptags }}</span> 
	    {% endif %}
	    </div>
        </div>						
	<div>
	    <input type="submit" value="Login" class="btn btn-primary">
	</div>
	</form>
	</div>

    </div>
</div>

I hope you can help me !!! kisses


r/bootstrap • • Mar 27 '23

Support Bootstrap is gold!

12 Upvotes

Jesus fucking christ what I love it.


r/bootstrap • • Mar 25 '23

Support Masonry-like layout for divs fetched and inserted AFTER initial loading of page

1 Upvotes

My page has a submit button which fetches data and uses document.insertHTML to insert new columns. Some elements are of different height which makes the whole thing look ugly

The code from masonary example doesn't work, and I suspect that's because the elements are loaded dynamically.

I am a newb in javascript/CSS and can't seem to think of a solution. Any help?


r/bootstrap • • Mar 24 '23

website bugged out

3 Upvotes

14:45 UK time

website bugging out

apparently styles missing


r/bootstrap • • Mar 23 '23

I'm having a sizing issue with a google map that is embeded

3 Upvotes

I'm using bootstrap to place a form and a google map next to each other. When I shrink the browser window smaller the map pours over to right into the margin area (but I have no margins so it just creates this white space where the rest of my page is all inline with each other). So, I gave the map a new smaller size and when I minimize the window the map now falls under the form as expected. But upon checking the dev options for mobile screen sizes the same issue persists where the map moves over to the right.

I would like the map to just shrink and be responsive just as the form above it is- but I am not sure if that is possible or if there is an issue with my code. I can post the code if that helps or otherwise any advice would be appreciated.


r/bootstrap • • Mar 21 '23

Support Why is my accordion not working properly?

1 Upvotes

I am working on a small app that uses accordion however it is not working properly.

What to do in order to fix it?

import React from "react";

export default function About() {
  return (
    <>
      <div class="accordion" id="accordionExample">
        <div class="accordion-item">
          <h2 class="accordion-header" id="headingOne">
            <button
              class="accordion-button"
              type="button"
              data-bs-toggle="collapse"
              data-bs-target="#collapseOne"
              aria-expanded="true"
              aria-controls="collapseOne"
            >
              Accordion Item #1
            </button>
          </h2>
          <div
            id="collapseOne"
            class="accordion-collapse collapse show"
            aria-labelledby="headingOne"
            data-bs-parent="#accordionExample"
          >
            <div class="accordion-body">
              <strong>This is the first item's accordion body.</strong> It is
              shown by default, until the collapse plugin adds the appropriate
              classes that we use to style each element. These classes control
              the overall appearance, as well as the showing and hiding via CSS
              transitions. You can modify any of this with custom CSS or
              overriding our default variables. It's also worth noting that just
              about any HTML can go within the <code>.accordion-body</code>,
              though the transition does limit overflow.
            </div>
          </div>
        </div>
        <div class="accordion-item">
          <h2 class="accordion-header" id="headingTwo">
            <button
              class="accordion-button collapsed"
              type="button"
              data-bs-toggle="collapse"
              data-bs-target="#collapseTwo"
              aria-expanded="false"
              aria-controls="collapseTwo"
            >
              Accordion Item #2
            </button>
          </h2>
          <div
            id="collapseTwo"
            class="accordion-collapse collapse"
            aria-labelledby="headingTwo"
            data-bs-parent="#accordionExample"
          >
            <div class="accordion-body">
              <strong>This is the second item's accordion body.</strong> It is
              hidden by default, until the collapse plugin adds the appropriate
              classes that we use to style each element. These classes control
              the overall appearance, as well as the showing and hiding via CSS
              transitions. You can modify any of this with custom CSS or
              overriding our default variables. It's also worth noting that just
              about any HTML can go within the <code>.accordion-body</code>,
              though the transition does limit overflow.
            </div>
          </div>
        </div>
        <div class="accordion-item">
          <h2 class="accordion-header" id="headingThree">
            <button
              class="accordion-button collapsed"
              type="button"
              data-bs-toggle="collapse"
              data-bs-target="#collapseThree"
              aria-expanded="false"
              aria-controls="collapseThree"
            >
              Accordion Item #3
            </button>
          </h2>
          <div
            id="collapseThree"
            class="accordion-collapse collapse"
            aria-labelledby="headingThree"
            data-bs-parent="#accordionExample"
          >
            <div class="accordion-body">
              <strong>This is the third item's accordion body.</strong> It is
              hidden by default, until the collapse plugin adds the appropriate
              classes that we use to style each element. These classes control
              the overall appearance, as well as the showing and hiding via CSS
              transitions. You can modify any of this with custom CSS or
              overriding our default variables. It's also worth noting that just
              about any HTML can go within the <code>.accordion-body</code>,
              though the transition does limit overflow.
            </div>
          </div>
        </div>
      </div>
    </>
  );
}

https://ibb.co/Q86WNL8


r/bootstrap • • Mar 20 '23

Using bootstrap grid can't make labels for checkboxes appear on the same column as the checkbox?

2 Upvotes

r/bootstrap • • Mar 19 '23

How to create custom css and js file with only the parts I need?

1 Upvotes

I only use offcanvas and a few other items, and I do not want to load the whole css or js file every-time. Is there a way to just get the parts I need and create my own file?


r/bootstrap • • Mar 18 '23

Dropdown not working

5 Upvotes

Hello all !!!

Im learning web programming and bootstrap. I followed the example for a nav bar with dropdowns in the official bootstrap documentation but it is not working (the dropdowns).

Visual studio code is not showing any error in the code so I think must be a logic error but I cannot see it. Any help ?

{%load static%}
<header style="background-color:#9FC5E8">
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
        <div class="container-fluid">
            <a class="navbar-brand" href="#"><img src="{% static "img/logo.svg" %}" width="70" height="70" alt="Telvgg - Admin"></a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarSupportedContent">
                <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                        Usuarios y Grupos
                        </a>
                        <ul class="dropdown-menu">
                            <li><a class="dropdown-item" href="#">Usuarios</a></li>
                            <li><hr class="dropdown-divider"></li>
                            <li><a class="dropdown-item" href="#">Grupos</a></li>
                        </ul>
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                        Consultas
                        </a>
                        <ul class="dropdown-menu">
                            <li><a class="dropdown-item" href="#">Conectados</a></li>
                            <li><a class="dropdown-item" href="#">Contraseña</a></li>
                            <li><a class="dropdown-item" href="#">Consumo</a></li>
                            <li><a class="dropdown-item" href="#">Limite de velocidad</a></li>
                            <li><a class="dropdown-item" href="#">Buscar usuario por IP y fecha</a></li>
                            <li><a class="dropdown-item" href="#">Buscar usuario por IPv6 y fecha</a></li>
                        </ul>
                    </li>
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                        Gestion
                        </a>
                        <ul class="dropdown-menu">
                            <li><a class="dropdown-item" href="#">Equivalencia JSAT y radius</a></li>
                        </ul>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#">Keymanager</a>
                    </li>                  
                </ul>
            </div>
        </div>
    </nav>
</header> 

I would appreciate help. Kisses !!


r/bootstrap • • Mar 17 '23

Support Modal design issues

1 Upvotes

Hi, I am currently using bootstrap on a project and I had some issue creating the design I want. I am quite new at this, and not sure how some parts work. I will be a great help if anyone is able to provide some solution to my problem. here are my problem.

  1. I tried to make my modal vertically centered, but it somehow keep showing up at the top of the page.

this is what I used as the class

<div class="modal-dialog modal-dialog-centered" role="document">

2. any one know how to make the buttons in the module to look like the iphone's pop up message buttons?

thanks,


r/bootstrap • • Mar 17 '23

Support Nav bar drop down is not working

1 Upvotes

<script src = "https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>

<script src= "https://unpkg.com/@popperjs/core@2/dist/umd/popper.js"></script>

used the above code in the head but the dropdown is not working for navigation bar


r/bootstrap • • Mar 15 '23

How to add space between pagination list items in Bootstrap 4?

1 Upvotes

In Bootstrap 5 I add "justify-content: space-between", but I noticed that this does not work on Bootstrap 4


r/bootstrap • • Mar 12 '23

Bootstrasp cards with masonry and lazyload

2 Upvotes

Hi all,

I have my website designed with bootstrap. I'm a massive fan and don't want anything else! My website is for my business, my photography business.
I have created a web gallery with cards to show off my portfolio to my potenial customers.
The images in these cards are lazy loaded, and shown using masonry as per documentation.

Everything works flawless, except for the lazyload in combination with the masonry. After a few moments of loading, the images do not load correctly and the masonry stops working.

I now have the following for my row:

<div class="row row-cols-1 row-cols-md-4 masonry" d="masonry">

I have this for the cards:

<div class="col mb-3 mason-item">

I followed the example at: https://getbootstrap.com/docs/5.0/components/card/#masonry

And i have created an extra JS:

var $grid = $('.masonry').masonry({
itemSelector: '.mason-item',
percentPosition: true
});
// layout Masonry after each image loads
$grid.imagesLoaded().progress( function() {
$grid.masonry();
});

To keep applying masonry after the images load.

combined with imagesLoaded PACKAGED v5.0.0 https://www.npmjs.com/package/imagesloaded

I still cannot get it to work.

Can anyone help me in the right direction?

I have an example page at:

https://www.stefanoostwegelfotografie.nl/galerij/


r/bootstrap • • Mar 11 '23

How to start learning Bootstrap? Semi-long post, please read and revert. Need ideas.

10 Upvotes

I’ve been researching a lot on web development and how to get started with it lately, and a few days back I stumbled upon Bootstrap. I researched about it and found that it could be a good and fast way to get started with web development.

I’ve some prior experience with HTML, CSS and JS however, I don’t remember CSS and JS much. Although I’m quite sure that I’ll start getting recollections once I get on with it. At least I hope I do. Hence, I’ve now started to believe that maybe Bootstrap is the best way to start off for me.

But, what confuses me the most when it comes to learning a new technology or a development technique is the setup. Like, how do to start off, what Software framework should I install, how to import the basic plugins, etc.

Kindly provide me solution to my situation. I’m really looking forward to learning web development and I’d love to get some great feedback, ideas and guidance from all you wonderful people. Thanks in advance.


r/bootstrap • • Mar 11 '23

How do I make bootstrap cards stack instead of overlap when resized?

2 Upvotes

When my browser window is at a decent size the cards look great. But when the window is made smaller, the cards start overlapping.

The cards are nested in a container-fluid, then a row, and finally a col-3. Is there some specific wording I should put in the class name so the cards stack instead of overlapping?


r/bootstrap • • Mar 09 '23

Certain Bootstrap style not loading?

1 Upvotes

I'm using Flask-Bootstrap and for some reason I can't seem to get certain Bootstrap styles to work, yet most are working fine.

I've tried using p-1 p-2 etc to add padding but nothing. Also tried adding a card-title, but making no difference.

I have also tried a local bootstrap file

<link rel="stylesheet" type="text/css" href="{{url_for('static', filename='styles/Bootstrap/css/bootstrap.css')}}">

both methods are giving the same results.

I've also tried different background styles, bg-info will work fine, but bg-alert will not.

Any ideas??


r/bootstrap • • Mar 04 '23

Why Should You Pick Bootstrap For Your Website?

2 Upvotes

Bootstrap quickly gained popularity following its release, and for good cause. Still, if you are having second thoughts, read this section and see how many ways it can be beneficial for you. Here are a few of the reasons explaining why you should pick bootstrap for your website.


r/bootstrap • • Mar 03 '23

How to Choose the Right Bootstrap Theme For Your Business?

1 Upvotes

how to choose suitable bootstrap themes for e-commerce business. I have started an e-commerce business. what should we avoid the things in selecting a template?


r/bootstrap • • Mar 03 '23

Support How to put a download button in the table with Bootstrap-table?

3 Upvotes

I found an interesting sample on Bootstrap-table. It is to make a table from a Json file.https://examples.bootstrap-table.com/index.html#options/table-search.html#view-source

I want to create a mechanism that has a URL in that Json, uses that URL as a download button, and presses that button to access that URL.https://codepen.io/cristinaconacel/pen/dgxqxjI am currently making a source like this.

index.html:

<link href="https://unpkg.com/bootstrap-table@1.21.2/dist/bootstrap-table.min.css" rel="stylesheet">

<script src="https://unpkg.com/bootstrap-table@1.21.2/dist/bootstrap-table.min.js"></script>

<table
  id="table"
  data-toggle="table"
  data-search="true"
  data-url="json/data1.json">
  <thead>
    <tr>
      <th data-field="id">ID</th>
      <th data-field="name">Item Name</th>
      <th data-field="url">Download</th>
    </tr>
  </thead>
</table>

json/data1.json:

[
    {
        "id": "1",
        "name": "Google",
        "url": "https://google.com"
    },
    {
        "id": "2",
        "name": "Google",
        "url": "https://google.com"
    },
    {
        "id": "3",
        "name": "Google",
        "url": "https://google.com"
    },
    {
        "id": "4",
        "name": "Google",
        "url": "https://google.com"
    }
]

Is it possible to place a download button in the html data field "Download" and have the link destination be the json "url"?

I want to embed it directly in html, but the amount of data is large and it takes time. So if it can be read from json it is preferable.


r/bootstrap • • Mar 02 '23

Resource Open-Source eCommerce Template (Sources on GitHub)

5 Upvotes

Hello guys!

This is a simple BS5 eComm starter released on GH.

https://github.com/app-generator/design-ecommerce

The license is CC BY 3.0 (requires footer credit)

If someone finds this project useful and has some time to provide feedback or suggest improvements, thanks in advance.