Bootstrap HTML carriage return - html

After one hour for isolating the problem, I can post this :)
I've a problem with local file but not in production. THe only difference is that on production, html files are inlined.
I'm using default bootstrap 3.3.5 and this css class :
<style>
.v-center {
display: inline-block;
float: none;
}
</style>
My problem is that I don't have the same result with both code :
Code 1 :
<div class="row">
<div class="col-md-4 v-center">
col-md-4
</div><div class="col-md-8 v-center">
col-md-8
</div>
</div>
Code 2 :
<div class="row">
<div class="col-md-4 v-center">
col-md-4
</div>
<div class="col-md-8 v-center">
col-md-8
</div>
</div>
You can found here two examples :
http://relationeo.com/test.html
http://relationeo.com/test2.html
The bug is happening when window with is > 990px.
Why the carriage return breaks the col ?
Thanks

The problem is your CSS class "v-center". It sets the display to inline-block. With inline-block white space comes into play (at least the first character of white space, anyways). Just as you would expect:
Just
Testing
To be rendered as Just Testing rather than JustTesting, the same applies to inline or inline-block elements.
Long and short, don't mess with the Bootstrap grid if you expect to have consistent results. If you need to apply other classes, do so within the grid div, not on the same div. For example:
<div class="col-md-8"> <!-- this is grid div, so no other classes here -->
<div class="v-center">
...
</div>
</div>

Related

Bootstrap Grid does not fit divs in one line

I can't understand why this doesn't work. There are 12 columns but it's work only with 11
HTML
<section>
<div class="container">
<div class="row">
<div class="advantages col-12">
<div class="col-4">one</div>
<div class="col-4">two</div>
<div class="col-4">three</div>
</div>
</div>
</div>
</section>
SASS
.advantages
text-align: center
div
display: inline-block
You should remove col-12 and let your col-4 sit within .row. A col must be immediately preceeded by a row.
Since 4+4+4 = 12, you don't have to define your previous col-12, and you shouldn't have to set anything to inline-block.
It's what #Jay Kariesch said, but you can also keep advantages in the same div as row, like this:
<div class="advantages row">
This way you will keep advantages class working for all the divs inside.

How to set margin/padding for a device

Im making my website responsive for devices but i want to know if i can set a grid or margin/padding property for iphone so i can place it nicely and not 2 paragraphs in eachother.
I already tried to grid some text but it still looks weird in eachother this is my code:
<div class="row">
<div class="col-xs-1 col-lg-12">
Thisismy Test
</div>
</div>
You haven't tagged this as being a Bootstrap grid, but I'm assuming it is because of your grid classes.
You mention that you want to stop the navbar-brand text from wrapping on an iPhone so I'm wondering if there's there a reason why you wouldn't make the navbar-brand parent wider?
It looks to me as if it would need to be minimum col-xs-5
Here's a example showing both your existing HTML and the modification
https://codepen.io/panchroma/pen/OgQxBw
HTML
<div class="row">
<div class="col-xs-5 col-lg-12">
Thisismy Test
</div>
</div>
If you want to show the paragraph in entire row in mobile , use col-xs-12 class which will occupy the entire row space and display everything in one row in all th escreen sizes.
<div class="row">
<div class="col-xs-12">
Thisismy Test
</div>
</div>
If you want to display 2 paragraphs in row side by side use col-xs-6 for each div
<div class="row">
<div class="col-xs-6 col-lg-12">
Thisismy Test
</div>
<div class="col-xs-6 col-lg-12">
Thisismy Test
</div>
</div>
If you want to write your own CSS , you can do that by using media queries to define custom CSS for different screen sizes https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries

Display inline-flex but keep full width

I have place two div inside an inline-flex div one of the two divs width reduces. I'm using bootstrap:
<section>
<div class="container">
<div class="flexx">
<div class="foo">
....
</div>
<div class="col-md-10">
<div class="card">
<div class="card-block">
...
</div>
</div>
</div>
</div>
</div>
</section>
Basically, foo class should be inline with col-md-10 which it does but col-md-10 gets small instead it should still be at 100%. Am I doing it correct? I'm not strong with css/scss.
I'm not sure I entirely understand your issue. inline-flex items do not default to full width. You will need to add some css for that to happen since in the css for bootstrap the flex-grow property is set to 0;
I think adding one style and a class will fix your issue, again if I understand you right.
// to your html
<div class="col foo">
....
</div>
// to your css
[class^="col"] {
flex-grow: 1;
}
Check out this pen for help

Bootstrap Cols empty Space 700-900 Width ~ Why?

I have an issue with bootstrap atm. and cant figure out why my col elements create wierd empty spaces. It should be a simple issue but I am searching for an hour now and still cant find the solution.
Website with the problem: http://www.concierge-service-dortmund.de/
Its happens on all browsers at width 700-900 ~
Thats the problem screenshot: http://puu.sh/lAogM/bbaef8e510.jpg
I`ve tried some solutions which I found here but they didnt worked and actually the issues there were a bit more complex.
Thanks!
Thats a float issue. The "Gardinenwäsche" div needs a clear: left; to repair the DOM.
The row which separates the blocks has "margin-left: -15px;" and "margin-right: -15px;" and this is causing the boxes jump underneath.
To fix this, add a class to the div with rows (there are 4 on the site) to remove the margin.
<div class="row noMargin">
CSS:
.noMargin {
margin: 0 !important;
}
Bootstrap columns allow nesting! Since you're using 1 2 or 4 columns you can change your markup to the following:
<div class="row">
<div class="col-xs-12 col-sm-6">
<div class="row">
<div class="col-xs-12 col-lg-6">
</div>
<div class="col-xs-12 col-lg-6">
</div>
</div>
</div>
<div class="col-xs-12 col-sm-6">
<div class="row">
<div class="col-xs-12 col-lg-6">
</div>
<div class="col-xs-12 col-lg-6">
</div>
</div>
</div>
</div>
OffTopic: Bootstrap is "mobile first" remember to add a col-xs-* to every column no matter if it will be 100% anyways, you might prevent some clearing issues with that.

Bootstrap - Columns will not stack vertically on xs

I must be missing something obvious here, but I am a beginner with Bootstrap and I have no idea what it could be. I'm trying to get this picture and the adjacent paragraph to stack vertically on xs screens. No matter what I do, they just line up alongside each other, pushing the picture to the edge of the screen. Here's a picture of what is happening, and my code.
<div class="row para-text vertical-align">
<div class="col-xs-12 col-md-8 col-md-push-4">
<p>text....</p>
</div>
<div class="clearfix visible-sm-block"></div>
<div class="col-xs-12 col-md-4 col-md-pull-8">
<img class="img-full" src="img/artesia1.jpg" alt="">
</div>
</div>
Here are the css styles I've added, in case those are causing problems
.para-text {
padding:15px;
}
.vertical-align {
display: flex;
align-items: center;
}
I would recommend not using your css classes that you posted. When I did a simple example with your html code but no css, it seems to work fine:
Please see: http://www.bootply.com/GCu0vDtk6K
Note: I also removed your:
<div class="clearfix visible-sm-block"></div>
Looks like my problem was using Flexbox. I've opted out of using it and am going to find a different way to vertical align the image so that I can have better browser support.