Float right table doesnt work - css

I tried to apply the float: right to the button and the text but its just not working because it destroys everything.
Any ideas?
<hr>
<div class="table">
<div class="row">
<i class="fa fa-refresh" aria-hidden="true" style="margin-right: 4px;"></i> Aktualisieren
<span class="right-cell"> 14 neue Meldungen</span>
</div>
</div>
<hr>
https://jsfiddle.net/uoyh2fk9/

Not sure what, "destroys everything" means, but it sounds like flexbox might work better for what you are trying to achieve. Remove the display: table's from your divs and try the following:
CSS
.row {
display: flex;
justify-content: flex-end;
}
JSFiddle
If you would like to know more about flexbox and how it works, here is a link.

Here's a possible solution: https://jsfiddle.net/UXEngineer/uoyh2fk9/9/
<div class="container-fluid">
<div class="col-lg-12">
<div class="col-md-3 col-sm-3 border-red">
<a href="#" class="btn btn-primary">
<i class="fa fa-refresh" aria-hidden="true" style="margin-right: 4px;"></i> Aktualisieren</a>
</div>
<div class="col-md-9 col-sm-9 border-red">
<span>14 neue Meldungen</span>
</div>
<div class="col-lg-12 clearfix"></div>
<div class="col-lg-12 clearfix">
<hr class="horizontal-divider">
</div>
<div class="col-md-9 col-sm-9 border-red">
<span>14 neue Meldungen</span>
</div>
<div class="col-md-3 col-sm-3 border-red">
<a href="#" class="btn btn-primary">
<i class="fa fa-refresh" aria-hidden="true" style="margin-right: 4px;"></i> Aktualisieren</a>
</div>
</div>
</div>
I've added a responsive solution using the Bootstrap CDN to the example in JSFiddle. If you want to use this jsfiddle make sure you also add the CDN external sources to the your solution.
You can change the column size to fit your solution.

Related

How to remove the space for column on Bootstrap 4 Grid Layout?

I am working on removing the space between Front End Developer and About Me modal. It doesn't seem to to work when I used classes such as no gutter and removing the paddings.
Reference image
Does anyone have any ideas?
<header>
<div class="row no-gutters">
<div class="col-md-4 col-sm-12">
<img class="title-logo" src="./resources/images/logo.jpeg">
</div>
<div class="title-super col-md-4 col-sm-12 offset-md-4 text-uppercase text-right">
<h1>Terence Fan</h1>
<h4>Front-End Developer</h4>
<button type="button" class="btn btn-outline-dark button-style" data-toggle='modal' data-target="#AboutMe">About Me</button>
</div>
</div>
<div class="row">
<div class="col-md-12">
<hr>
</div>
</div>
</header>
I have the full Github source code here
Thanks in advance!
Try adding this code to your CSS.
.title-super .btn {
vertical-align: top;
}
set vertical-align: top to button-style
.button-style {
vertical-align: top;
}
working fiddle here
You can use .align-top bootstrap css class for vertical align element.
<button type="button" class="btn btn-outline-dark button-style align-top" data-toggle='modal' data-target="#AboutMe">About Me</button>

Bootstrap 4 center header elements on mobile

Here is my header setup (bootstrap 4):
<div class="container">
<div class="row">
<div class="col-md-6">
<div class="navbar-brand"><img src="..."></div>
</div>
<div class="col-md-6 text-right">
<div class="header-btn-grp">
<div class="header-call-us">Get a Quote, Call Today!</div>
<a role="button" class="btn btn-danger btn-lg header-btn" href="tel:123">Ph : <strong>...</strong></a>
<div class="header-address">XXX</div>
</div>
</div>
</div>
As expected on desktop the logo sits on the left and the button sits on the right.
When on smaller devices I would like the logo and button to align in the center.
I have tried to add a .text-md-center class to both columns but this caused both elements to center in there columns at all widths (desktop and mobile).
What is the correct way to do this?
An alternate to #cwanjt answer is using the text-center. You just then need to use text-md-left and text-md-right to keep the desired alignment on larger widths.
<div class="container">
<div class="row">
<div class="col-md-6 text-md-left text-center">
<div class="navbar-brand"><img src="//placehold.it/140x30"></div>
</div>
<div class="col-md-6 text-md-right text-center">
<div class="header-btn-grp">
<div class="header-call-us">Get a Quote, Call Today!</div>
<a role="button" class="btn btn-danger btn-lg header-btn" href="tel:123">Ph : <strong>...</strong></a>
<div class="header-address">XXX</div>
</div>
</div>
</div>
</div>
https://www.codeply.com/go/Ijl31XHfRT
#TimothyAURA, if I'm understanding you question correctly, it's how to center the content of your header on smaller screens. If that's the case, you can look at the code in this codeply project to get an idea of how to do that. It seems like you have some familiarity with Bootstrap, but here's a reference to Bootstraps utilities for justifying content.
It uses a justify-content-center class for device sized medium and below, and a justify-content-lg-between on larger displays.
<header class="d-flex justify-content-center justify-content-lg-between">
<a class="navbar-brand" href="#">
<img src="http://via.placeholder.com/65x65" alt="">
</a>
<div class="header-btn-grp">
<div class="header-call-us">Get a Quote, Call Today!</div>
<a role="button" class="btn btn-danger btn-lg header-btn" href="tel:123">Ph : <strong>...</strong></a>
<div class="header-address">XXX</div>
</div>
</header>

Centering a div horizontally

I must be missing something really simple here:
<div class="row">
<div class="col-lg-12">
<a href="/add" class="btn btn-primary">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add User
</a>
</div>
</div>
<div class="row">
<div class="col-lg-12" ng-show="users.busy">
<div class="spinner-loader center-block"></div>
</div>
</div>
I've used the bootstrap classes, including center-block. Yet it always looks like this:
Why isn't the spinner icon in the centre of the page?
There is a work around to your problem by changing some HTML as follows
<div class="row">
<div class="col-lg-12 text-center" ng-show="users.busy">
<span class="spinner-loader">Loading</span>
</div>
</div>
instead of <div> for spinner I took a <span> which will be centered horizontally because of text-center class to parent <div>.
You can try this:
<div class="row">
<div class="col-lg-12">
<a href="/add" class="btn btn-primary">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add User
</a>
</div>
</div>
<center>
<div class="row">
<div class="col-lg-12" ng-show="users.busy">
<div class="spinner-loader"></div>
</div>
</div>
</center>
Instead of using center-block, add text-center class
I ve been using the bootstrap col-md-offset css to center my divs. For example:
<div class=container>
<div class=row>
<div class=form-horizontal>
<div class="col-md-offset-4 col-md-4">
<div class="your div">
</div>
</div>
</div>
</div>
Your div will be responsive, thus as you resize the window the div will remain in the center of the window.

Bootstrap - Pull Icon to Left of Text

In Bootstrap 3, I want to have an icon centered to the left of an H6 and some text.
Here's my code:
<div class="row">
<div class="col-sm-8">
<div class="pull-left"><i class="fa fa-life-ring fa-3x"></i></div>
<div class="pull-right">
<h6>Unlimited Support</h6>
We're here to help! Just ask away...
</div>
</div>
</div>
It looks like this right now (icon is above the text, rather than on the left):
How do I get it to format correctly?
This code:
<div class="row">
<div class="col-sm-8">
<div class="pull-right">
<h6><i class="fa fa-life-ring fa-3x"></i> Unlimited Support</h6>
We're here to help! Just ask away...
</div>
</div>
</div>
Displays like this:
But, I want to put the icon beside both lines of text (have the "We're here..." move to the right/not wrap underneath.
you can try this
jsFiddle Demo
<div class="media">
<a class="pull-left" href="#">
<img class="media-object" src="..." alt="...">
</a>
<div class="media-body">
<h4 class="media-heading">Media heading</h4>
...
</div>
</div>
If it's Bootstrap you could do something like this:
<div class="row">
<div class="col-md-2">
<i class="fa fa-life-ring fa-3x"></i>
</div>
<div class="col-md-10">
<h6>Unlimited Support</h6>
We're here to help! Just ask away...
</div>
</div>
Try this-
<div class="row">
<div class="col-sm-8">
<div class="pull-right">
<h6><i class="fa fa-life-ring fa-3x"></i> Unlimited Support</h6>
We're here to help! Just ask away...
</div>
</div>
</div>
Alternatively, you can try this (if you do not want your text pulled to the right).
<div class="row">
<div class="col-sm-8">
<h6><i class="fa fa-life-ring fa-3x"></i> Unlimited Support</h6>
We're here to help! Just ask away...
</div>
</div>
you can add put the text "We're here to help!..." in a span and give it some padding or margin on the left.
<div class="row">
<div class="col-sm-8">
<div class="pull-right">
<h6><i class="fa fa-life-ring fa-3x"></i> Unlimited Support</h6>
<span class="text-on-the-right">We're here to help! Just ask away...</span>
</div>
</div>
</div>
the CSS for the span class:
.text-on-the-right
{
margin-left:10px/* or the desired the width */
}
Looks like it should be simple enough, but you need to bash your elements around with some forced margins... here goes:
<div class="col-sm-6 custom">
<i class="fa fa-camera-retro fa-3x pull-left"></i>
<div class="text">
<h6 class="custom-margin">Unlimited Support</h6>
We're here to help! Just ask away...
CSS:
.text{margin-left: 60px;overflow: hidden;}
.custom-margin{margin-top:4px;margin-bottom:4px}
EXAMPLE: http://www.bootply.com/qvjfInH7yQ
ps - your code shows an h6 for "Unlimited Support" but your example image looks like it's something else. I've used h6 as starting point, but if it's something else, you'll need some more bashing precise tweaking of margins to get it into the right exact placement.
The following approach would be an alternative to the Bootstrap Grid:
<div>
<img class=position-absolute src="ICONNAME.svg" alt="ICON-ALT" width="40" height="40">
<div class=pl-3>
text right
</div>
</div>
Manual Bootstrap Spacing

Bootstrap: Button too high

I have a legend containing a button that I pull-right. Unfortunately, the button is too high. Please see a fiddle here.
<div class="container">
<div class="row pane" id="statistics-pane" style="">
<legend>Network<span class="btn btn-mini pull-right">Test</span>
</legend>
</div>
</div>
I would separate the pull-right class from your button, and wrap in a div, like
<div class="container">
<div class="row pane" id="statistics-pane" style="">
<legend>Network
<div class="pull-right">
<span class="btn btn-mini">Test</span>
</div>
</legend>
</div>
</div>
Maybe give it a top-margin to push it down a little?
legend .btn {
margin-top: 10px;
}

Resources