Bootstrap empty space in a column - html

Please see the attachment for more detailed comprehension
I'm using Bootstrap in my current project. As you can see from the picture, there's a blank space that comes in a first column right after the content. Though if I just use columns without any styling, clearly the desired space isn't going to take place. What is the best solution for this problem? I was thinking of wrapping the content in a div with min-height rule but obviously it's a clumsy option.
Thank you.

That is your grid gutter. You can change the width of it with a custom build or by using the source code and changing the scss variable $grid-gutter-width.

As said, the problem is with the gutters.
I use this classes to avoid gutter when I don't want them:
css:
.row.no-gutters {
margin-right: 0;
margin-left: 0;
}
.row.no-gutters > [class^='col-'],
.row.no-gutters > [class*=' col-'] {
padding-right: 0;
padding-left: 0;
}
// I use those for removing side padding when necessary for an specific col
[class^='col-'].no-pad, [class*=' col-'].no-pad {
padding: 0px;
}
[class^='col-'].no-left-pad, [class*=' col-'].no-left-pad {
padding-left: 0px;
}
[class^='col-'].no-right-pad, [class*=' col-'].no-right-pad {
padding-right: 0px;
}
sass:
.row.no-gutters {
margin-right: 0;
margin-left: 0;
> [class^='col-'], > [class*=' col-'] {
padding-right: 0;
padding-left: 0;
}
}
// I use those for removing side padding when necessary for an specific col
[class^='col-'].no-pad, [class*=' col-'].no-pad {
padding: 0px;
}
[class^='col-'].no-left-pad, [class*=' col-'].no-left-pad {
padding-left: 0px;
}
[class^='col-'].no-right-pad, [class*=' col-'].no-right-pad {
padding-right: 0px;
}

Related

Navbar changes height size ... need it one size?

I am trying to make it so my navbar at link
is not long in height. I have been searching for an answer to this without any real luck, although got close using this answer
Instead of
and add these 3 line of css
.navbar-xs { min-height:28px; height: 28px; }
.navbar-xs .navbar-brand{ padding: 0px 12px;font-size: 16px;line-height: 28px; }
.navbar-xs .navbar-nav > li > a { padding-top: 0px; padding-bottom: 0px; line-height: 28px; }..
but it stripped out all of my styles. Is there a way to do this?
.nav > li > a {
padding-left: 5px;
padding-right: 5px;
}
In your case there is no need not use container inside bootstrap nav tag.
Getting rid of it has reduced the height of the navbar.

CSS3 :not is not excluding an id

Hey there dear Stackoverflow Community,
here my css:
.text:not(#overview > *) {
margin-top: 10px;
margin-bottom: 10px;
}
i wanted that everything with the class "text" has a margin to the top and bottom of 10px, but not the one marked with the id "overview" and everything under it.
But the css isnĀ“t working as expected.
Thanks for your help
Yasin
Isn't working as expected? So it doesn't exclude the id itself right? For that you need to add the id as well:
.text:not(#overview) {
margin-top: 10px;
margin-bottom: 10px;
}
What you are doing now, is just targetting everything inside the id and not the id itself. This will make sure that the id is also targeted.
You can also reset it using:
.text {
margin-top: 10px;
margin-bottom: 10px;
}
#overview.text {
margin-top: 0;
margin-bottom: 0;
}
The id has more specificity than class.
Well you could do it like this, but not sure if it is the right way!
.text {
margin-top: 10px;
margin-bottom: 10px;
}
#overview {
margin-top: 0;
margin-bottom: 0;
}

Bootstrap CSS Padding Issue

I am trying to make an "Inbox" in bootstrap similar to Gmail's look and feel.
I am having some issues with the Panel that the mail items are in however.
http://jsfiddle.net/64t872o1/
I am having trouble getting rid of this Margin or padding and I cant figure out what it is.
I have set the margins and padding of the panel body to zero but it still remains.
.panel-body{
padding: 0px;
padding-bottom: 0px;
margin-bottom: none;
}
Is there an easy way to figure out where this padding is coming from?
You are seeing the margin that is set on the .list-group element.
Updated Example
.tab-content .list-group {
margin-bottom: 0;
}
Here is the initial styling set in the main Bootstrap file:
.list-group {
padding-left: 0;
margin-bottom: 20px;
}
The best way:
.tab-content .list-group {
margin-bottom: 0;
}
Add this in your css :
.tab-content .list-group{margin-bottom:0;}
Use this:
.list-group { margin-bottom: 0px; }

Which is the best way to handle RTL CSS

Right now I'm working on a bilingual website and kinda confuse about how to handle the RTL CSS codes. I have 2 things in my mind as follows;
1. Single CSS file - Overriding LTR default codes.
.content {
position: relative;
padding: 5px 10px 5px 240px;
}
.rtl .content {
padding-right: 240px;
padding-left: 10px;
}
2. Single CSS file - Without overiding
.content {
position: relative;
padding-top: 5px;
padding-bottom: 5px;
}
.ltr .content {
padding-left: 240px;
padding-right: 10px;
}
.rtl .content {
padding-right: 240px;
padding-left: 10px;
}
Using the first method, there will a lot of overrides. Also using the second method there will be a lot of codes in the css file. I know both will do the trick but curious to know which is the best method. Kindly suggest me if there is another method too.
If you are looking for a more robust solution, I would suggest you these approaches:
CSS Preprocessor
Learn and use a CSS preprocessor like LESS (if necessary, use a plugin like Bi-App-Less) and conditionally add the correct stylesheet.
Back-end controlled variable
Use CSS mixed with some back-end variable like:
direction: <%=rtl%>;
padding-<%=right%>: 10px;
padding-<%=left%>: 240px;.
RTL Tool
Use a RTLer tool.
CSS can display your text right to left with this:
.rtl
{
direction:rtl;
}
I prefer to handle padding and margins on a single line:
.content {
position: relative;
padding:5px 10px 5px 240px;
}
.rtl .content {
padding:0 240px 0 10px;
}
You could try doing something like this
.content {
width: 500px;
padding: 5px 10px;
border: 1px solid #ddd;
}
.content.rtl {
float: right;
direction: rtl;
}
try to hardcode the minimum amount of paddings/margins specific to a direction, heres an example http://jsfiddle.net/icodeforlove/UNS5L/

SASS grid system outer padding

I've made this own fluid grid system in SASS, but there is a problem.
I've set the padding-left and padding-right both to 20px, which is the gutter width (the space between each column).
Which is all working fine, but the first and the last column in a row sets the padding as well on the outer sides. This I want to prevent but I have no idea what calculation I have to make for that.
The grid currently looks like this: (the red spacing is what I want removed)
The code for the system looks like this:
#import "../../mixins/cross-browser-elements/_box";
$column-count: 12 !default;
$gutter-width-px: 20px !default;
#function calculate-column-width($index) {
#if ($index > 0) {
#return percentage($index / $column-count);
}
}
.row {
overflow: hidden;
max-width: 100%;
margin-bottom: 20px;
> .column {
float: left;
min-height: 1px;
padding-left: ($gutter-width-px / 2);
padding-right: ($gutter-width-px / 2);
#include box-sizing(border-box);
#for $index from 1 through $column-count {
&.size-#{$index} {
width: calculate-column-width($index);
}
}
}
}
The thing I tried was just adding this piece of code:
&:first-child {
padding-left: 0;
}
&:last-child {
padding-right: 0;
}
Under this piece of code
> .column {
......
But that just made the first and last column in that row a bit bigger on the left and right side.
Why not add 20px negative margin to the left and right side on ".row"?
.row {
margin: 0 -20px 20px;
...
}
You could add this extra lines to your mixin:
...
#for $index from 1 through $column-count {
&.size-#{$index} {
width: calculate-column-width($index);
&:nth-child(#{$column-count}n) { // Clear every last item padding-right
padding-right: 0;
}
&:nth-child(1) { // Clear every first item padding-left
padding-left: 0;
}
}
}
...
An example: http://sassmeister.com/gist/da6c1a341d289b4f3b67