Grid margin impacted by floated button in Semantic UI

For more information, check out: http://jsfiddle.net/3tL9msap/2

The grid's right margin is being affected by the button's width, pushing it inwards.

To see the difference, view the layout without the button at this link: http://jsfiddle.net/3tL9msap/3, where the margins are equal on both sides, as expected.

This issue with the button occurs even when the <h1> and <button> elements are placed within their own container <div class="ui container"> at the top of the structure.

If this behavior is intentional, how can I align the button to the right without impacting the grid margins?

Here is the HTML code snippet:

<div class="ui container">
    <button class="ui right floated primary button"><i class="plus icon"></i> New entry</button>
    <h1>Why does the button cause alignment issues?</h1>
    <div class="ui grid">
        <div class="stretched row">
            <div class="twelve wide column">
                <div class="ui segment">Left column</div>
            </div>
            <div class="four wide column">
                <div class="ui segment">
                    <h3>Elliot Fu</h3>
                    <p>Friends of Veronika</p>
                    <div class="ui two buttons">
                        <div class="ui basic green button">Approve</div>
                        <div class="ui basic red button">Decline</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

Answer №1

This behavior is to be expected, make sure to clear the float used by the button

EXAMPLE OF HTML WITH INLINE CSS

  <div class="ui grid" style="clear:both;">
        <div class="stretched row">
            <div class="twelve wide column">
                <div class="ui segment">Left column</div>
            </div>
            <div class="four wide column">
                <div class="ui segment">
                     <h3>Elliot Fu</h3>

                    <p>Friends of Veronika</p>
                    <div class="ui two buttons">
                        <div class="ui basic green button">Approve</div>
                        <div class="ui basic red button">Decline</div>
                    </div>
                </div>
            </div>
        </div>
    </div>

VIEW DEMONSTRATION HERE

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

Styling HTML code using Python

Looking for a way to automate the extraction of specific HTML code from a list of URLs in a CSV file using Python? Look no further! With this solution, you can easily download and save desired parts of the HTML code into another column. For instance: By ...

Considering the development of a web application similar to Canva

I'm interested in creating an app similar to Canva, but I'm not sure where to begin. I have a solid understanding of HTML and CSS, but my JavaScript skills are basic. I'm curious about the technologies they use. Is there a way to save HTM ...

"Enhance your website with the dynamic Twitter Bootstrap dropdown navigation

Is it possible to implement a dropdown menu using twitter bootstrap? The current navigation setup is as follows: <ul class="nav nav-tabs " style="width: 860px;"> <li > <a href="#" >Employees</a> </li> <li > < ...

Header reference differs from the document referrer

this is the request header: GET / HTTP/1.1 Host: localhost:3002 Connection: keep-alive sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="96", "Google Chrome";v="96" sec-ch-ua-mobile: ?0 User-Agent: ...

"Struggling with AngularJS nth-child not functioning properly within an ng-repeat loop

I've been working on changing the styling of every second row of content displayed on the page using ng-repeat. I managed to make it work for font color, however, I'm struggling with changing the background color. Below is my code. I would appre ...

What is the process for obtaining an HTML form, running it through a Python script, and then showcasing it on the screen

I am inquiring about the functionality of html and py script. .... The user enters 3 values for trapezoidal data from the html form: height, length of side 1, and length of side 2, then clicks submit. The entered values are then sent to be calculated using ...

Styling widgets on WordPress with CSS

I have implemented language translation flags on my Wordpress website: Below is the code snippet <ul> <li id="qtranslate-8" class="widget-container widget_qtranslate"> <ul class="qtrans_language_chooser" id="qtranslate-8-chooser"> <l ...

Tips on replacing views within ion-view and updating the title in the title bar to match the injected page through the use of Ionic and AngularJS

I am new to ionic and angular JS. I am currently working on a simple app within the ionic framework. My goal is to inject an HTML template into the ion-view tag using ngRoute. However, I am facing issues as my code is not successfully injecting the HTML te ...

Is there a substitute for HtmlUnit on Android?

Is there a different solution available that can help me complete an HTML form containing checkboxes and radio buttons? I was in the process of developing an Android application that requires user input, sends the data to a website with an HTML form, fill ...

Switch Between More and Less Text - Implement Smooth Transition on Shopify Using Javascript

I recently implemented a More/Less toggle button using resources from this website. The functionality is there, but I now want to add a smooth transition effect. When the user clicks on "read more," I would like the hidden content to gradually appear, and ...

Position Bootstrap Navbar in Location Dash

I am trying to center the links in my navbar, but currently they are aligned to the right using the 'ml-auto' classname. I have been unsuccessful in moving them to the center. Can anyone provide assistance? Below is the code snippet: nav_item = ...

Error: Property 'onclick' cannot be set on a null object

JavaScript isn't my strong suit, so I'm struggling to solve this issue. The console is showing me the following error message: Uncaught TypeError: Cannot set property 'onclick' of null <script> var modal = document.getE ...

Full-screen and auto-cropping capabilities are featured in the Bootstrap 4 carousel design

Is there a way to make full-width images in the bootstrap 4 carousel cropped based on position: center, background: cover to prevent scrolling issues? I attempted to follow advice from this webpage but encountered stretching and scroll-bar problems with d ...

Show a grid layout with adjustable sizing and elements centered in the middle

When dealing with a layout like the one below, how can we ensure that elements are centered within the wrap container? The margins around the elements should be flexible but at least 14px. .wrap{ display: grid; grid-template-columns: repeat(auto-fi ...

Incorporating numerous CSS components into a data-bind using Knockout

I have a situation where I need to apply multiple css classes to a div using knockout. Here is the initial div: <div data-bind="css: {'case-header': model.caseHeader1, 'case-type-1': model.caseHeader2, 'case-type-2&apo ...

Search for text within the nearest <p> tag using HTML and jQuery

My table contains different td elements with the same ID, as shown in this foreach loop: <td class="AMLLeft" style="display:inline-block; !important">ID: <p class="important">${item.id}</p> </td> <td align="right" nowrap="tr ...

AngularJS is failing to recognize the onload event when loading a URL

I am currently working with the AngularJS Framework and I have encountered an issue. My directive only seems to work when the window is fully loaded. screensCreators.directive('createscreen', function () { return { restrict: "A", ...

ExtJS Store proxy failing to update data in users.json file according to tutorial

Currently, I am referring to a tutorial found at this link: My extjs version is 4.2.1. The file path is app/controller/Users.js Ext.define('AM.controller.Users', { extend: 'Ext.app.Controller', models: ['User'], stores: [& ...

Utilize jQuery's .append() function to dynamically insert content into your webpage

I currently have tab elements set up like this: <div class="tab-pane fade active in" id="tab-a"> </div> To populate the content of that tab with a JavaScript string array, I am using the following code snippet: var full_list = ""; for (var ...

Show a variety of logos on the website based on the current date

I've been experimenting with displaying a unique logo on my website based on the current date (for example, showing a Christmas-themed logo during December). Here's what I have so far: <img class="logo" id="global_logo" sty ...