CSS conflicts arise when attempting to incorporate Bootstrap files into simplistic form designs

Attempting to replicate this basic design in edit mode.

https://i.sstatic.net/2gW9e.png

The following code showcases the image above:

<div class="user-description-container col-md-6 col-md-offset-3">
  <div class="col-md-3">
    <%= image_tag @user.image.standard.url, class: "user-picture img-circle" %>
  </div>
  <div class="user-description-box col-md-7">
    <div class="user-name"><%= @user.full_name %></div>
    <div class="user-stats">
      <div class="user-stats-debates inline-flex"><b class="spacing-margin-right">
        <%= @user.groups.length %></b><% if @user.groups.length == 0 %>
        <p> debate</p><% else %><p> debates</p>
      </div>

      <% end %>
      <div class="user-stats-followers inline-flex"><b class="spacing-margin-right"><%= @user.followers.length %></b> <%if @user.followers.length == 0%>
        <p> follower</p> <% else %><p> followers</p>
        <% end %>
      </div>
    </div>
    <div class="user-description">
      <%= @user.description %>
    </div>
  </div>
  <div class="col-md-2 edit-profile">
    <% if current_user == @user %>
      <%= link_to(edit_user_path(@user),:class =>"edit-button") do %>
        <i class="glyphicon glyphicon-pencil"></i>
      <% end %>
    <% end %>
  </div>
</div>

Tried copying the main page design into edit mode but encountered issues resulting in:https://i.sstatic.net/QSeVY.png

Having trouble with Bootstrap while using the simple_form gem on Rails. Here's my edit mode code:

<div class="container">
  <div class="row">
    <div class="user-description-container col-md-6 col-md-offset-3">
      <%= form_for @user do |form| %>
        <div class="user-upload-preview col-md-3">
          <%= image_tag @user.image.standard.url, class: "user-picture img-circle object-fit-covered" %>
          <div class="form-input">
            <label class="btn btn-sm btn-primary image-browse-button" >
              Choose a photo
              <span style="display:none;">
                <%= form.file_field :image %>
              </span>
            </label>
          </div>
        </div>
        <div class="user-description-box col-md-7">
          <div class="user-name">
            <%= @user.full_name %>
          </div>

          <div class="user-stats">
          <div class="user-stats-debates inline-flex"><b class="spacing-margin-right">
            <%= @user.groups.length %></b><% if @user.groups.length == 0 %>
            <p> debate</p><% else %><p> debates</p>
          </div>

          <% end %>
          <div class="user-stats-followers inline-flex"><b class="spacing-margin-right"><%= @user.followers.length %></b> <%if @user.followers.length == 0%>
            <p> follower</p> <% else %><p> followers</p>
            <% end %>
          </div>
          <div class="form-input inline-flex">
            <%= form.text_field :description, placeholder: "Description", class: "form-control" %>
          </div>
          <div class="form-input save-edit">
            <%= form.submit "Save", class: "form-control profile-submit-button" %>
          </div>
          <% end %>
        <div class="col-md-2">
        </div>
        </div>
    </div>
  </div>
</div>

Any assistance would be greatly appreciated.

Answer №1

When using Bootstrap, it's important to ensure that the sum of all col-md- classes adds up to 12 for a complete row. In your case, you have col-md-7, so consider adding a col-xs as well to fill the row. Here is a layout that might help illustrate what you're aiming to achieve:

      <div class="container">
            <div class="row">
              <div class="col-md-4">
                IMAGE
              </div>
              <div class="col-md-8">
                <div class="header">
                  <h1 class="page-header text-center">MY NAME</h1>
                </div>
                <div class="row">
                  <div class="col-md-6">
                    <h3 class="text-center">insert contents here</h3>
                    <center>
                      <div class="center">
                        <button class="btn btn-primary">BTN</button>
                      </div>
                    </center>
                  </div>
                  <div class="col-md-6">
                    <h3 class="text-center">insert contents here</h3>
                    <center>
                        <div class="center">
                          <button class="btn btn-primary">BTN</button>
                        </div>
                    </center>
                  </div>
                </div>
              </div>
            </div>
          </div>

It appears that you're entering user information, try to avoid using @user tags and references like .file. Instead, use appropriate HTML tags with IDs and utilize JavaScript to manipulate them accordingly.

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

Challenges with Image Alignment Using Bootstrap 4

I'm having trouble aligning images using Bootstrap 4. I placed them inside a .row within a .container, but there is unwanted whitespace between the images. My goal is to have the images sit right next to each other with no gaps. Any suggestions on how ...

"Create sleek and stylish forms with Bootstrap's horizontal

I am attempting to create a horizontal form in Bootstrap using the code provided in their documentation. The example they show has input boxes filling the entire column space, but for some reason this is not happening when I try it, even after copying the ...

If the window width is less than the specified value, hide the DIV and replace it with a

I came across a discussion about hiding a div if the screen is narrower than 1024px, and I'm looking to implement something similar based on the quoted code below. Essentially, I want to hide one div (id="krug_wide") if the window width is less than 1 ...

The HTML elements may have identical heights, but visually, one appears larger than the other

The size of the "login to enter chat" button seems to be larger than the messageBox div, despite adjusting padding and margins. What could be causing this issue? Any suggestions on how to fix this design glitch? #chatbox { width: 500px; height: ...

What is the best way to make the first LI elements stand out in a nested structure by applying bold

I had an idea like this: #list li > a { font-weight: bold; } However, I only want the top level items to be made bold, not nested LI's within LI's -- hope that makes sense?? :) EDIT | <ul id="list"> <li><a href="#"& ...

Combining Images and Navigation in Next.js using Tailwind CSS

I am facing an issue where the image from a particular section overlaps with the Navbar dropdown on mobile devices. Adding z-50 to the navbar did not solve the problem as expected. What I want is for the image to remain below the dropdown menu when it is ...

Guide on utilizing slider arrows for enabling Twitter Bootstrap tabnav controls

Previously, I sought help with an issue regarding a Navtab not being highlighted when active. The problem persists despite successfully configuring the slider to swipe to the corresponding slide upon selecting a tab. Specifically, if I manually slide fro ...

Utilize CSS to create spacing between columns in a webpage

I have incorporated a table into my project and here is the HTML snippet for reference: th { text-align: left; } td { height: 20px; font-size: 12px; background-color: #000; color: #fff; margin-right: 20px; border-top-left-radius: 10px; } ...

The content spilling out of a Bootstrap 4 row

UPDATE: Here is the link to the javascript fiddle When the text on the screen becomes too large for the row, it overlaps onto other rows instead of increasing the height of the row. This could be due to setting the row heights as a percentage value in ord ...

Error encountered when using Symfony 2 command line interface

Just started learning Symfony2 and encountered a problem. I made changes to my CSS and when I try to re-install them in Eclipse shell, I get this error message: 'C:\wamp\www\Symfony' is not recognized as an internal or external ...

Choosing a specific text within a webpage using Selenium

<aside class="reply-flap js-captcha"> <ul> <li> <h1>contact name:</h1> <p>joel Rupp</p> </li> <li class="reply-tel"> <h1> <a ...

Bootstrap-Colorpicker is throwing an error: "Unable to assign the 'colorpicker' property to an object that is

Looking to add a color picker to a form? Check out the bootstrap-colorpicker. I've set up mine by adapting code from the advanced forms page on the Admin LTE 2 demo: <!-- Color Picker --> <div class="form-group"> <label>Color p ...

Challenges with zoom feature in HTML within a browser window

My HTML site is experiencing some issues when I zoom in my browser. At fullscreen and 100% zoom, it looks fine, but when zooming or resizing the window, all elements resize and move randomly on the screen. I am looking for a solution where the zoom does ...

The calculator is experiencing issues with JavaScript functionality

Having some trouble developing a calculator using HTML5, CSS, and JavaScript. After passing my HTML and CSS through validators successfully, I encountered issues when adding JavaScript functions to enable the functionality of the buttons on the calculator. ...

Position a full-width image with an SVG mask to the right, outside of the container using Bootstrap

I'm currently experimenting with aligning an image with a SVG mask to the right, outside of a container, but it's causing overflow issues. Interestingly, when I switch and align the image to the left, there is no overflow problem. At the moment, ...

Creating an accessible order for the next and back buttons

Currently, I am working on designing the user interface for a checkout flow. Towards the end of the page, there are 3 buttons available - Next, Back, and Cancel. When viewed on a desktop, the button layout appears as follows: (Back) (Next) Cancel http ...

Utilize jQuery to create a dynamic image swapping and div showing/hiding feature

I'm having trouble implementing a toggle functionality for an image and another div simultaneously. Currently, when the image is clicked, it switches to display the other div, but clicking again does not switch it back. Can someone please advise on wh ...

The stickiness of elements causes scrollbars to disappear in Chrome 77 on OSX

In this scenario, I have set up two tables where the first one has a sticky header achieved with position: sticky; top: 0px; https://codepen.io/seunje/pen/JjjRVLm The sticky header works perfectly fine, but there is an issue with scrollbars disappea ...

Is there a way to modify the color scheme of my webpage while utilizing Bootstrap?

As I delve into programming with Bootstrap, I encountered an issue while attempting to change the background color of my body. Even though I used the following CSS code: body { background-color: #eba; width: 100%; height: 100%; } The color change ...

Having trouble with my JSFiddle code not functioning properly in a standard web browser for a Google Authenticator

Here is the code snippet that I am having trouble with: http://jsfiddle.net/sk1hg4h3/1/. It works fine in jsfiddle, but not in a normal browser. I have included the necessary elements in the head to call all the external files. <head> <scri ...