Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am always having this issue and I always solved it using webkit-columns. But I wanna know if there is a better way to do it with Bootstrap.
4 boxes inside a grid.
<div class="row">
<div class="col-sm-3"></div>
<div class="col-sm-3"></div>
<div class="col-sm-3"></div>
<div class="col-sm-3"></div>
</div>
This gives me the 4 boxes but the last box have more margin than the others. I want all of them to have the same margin, but 0 on the corners like the image:
--- EDIT FOR CLARIFY ---
For Clarify my question im gonna add this jsfiddle you see the blue box ? i want to the red boxes start and end with the blue box, can you do that ? not add margin to the blue box, the blue box must be 100% and the other box must be aligned with the first and end of that box
Here i do what i want: Jsfiddle but here im using -webkit-column just for show you, if you can do this with bootstrap that would be nice.
Im gonna share this Demo I created. I hope it gets you somewhere.
HTML
<div class="container">
<div class="row">
<div class="col-sm-3 custom-col">
<div class="child-div">
</div>
</div>
<div class="col-sm-3 custom-col">
<div class="child-div">
</div>
</div>
<div class="col-sm-3 custom-col">
<div class="child-div">
</div>
</div>
<div class="col-sm-3 custom-col">
<div class="child-div">
</div>
</div>
</div>
</div>
CSS
.col-sm-3.custom-col{
height:250px;
/* outline: 1px solid green; */
padding: 5px;
}
.child-div{
height:100%;
width:100%;
background-color:red;
}
UPDATE
I updated the fiddle. HERE
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am new to UI,
creating one blog layout in HTML with Bootstrap4, I am following this layout...'removed', how to create first div fixed and second scroll-able and then one full width banner and so on.
Before posting a question here, you need to try something from your end then if you are stuck, you can post questions here to get an answer.
First Step:
You need to learn the basics of HTML & CSS. (https://www.w3schools.com/html/html_css.asp)
To make a section FIXED, you need to use the POSITION property in CSS. (https://www.w3schools.com/css/css_positioning.asp)
I guess these are enough for you to get started.
Happy learning!
div class="container-fluid">
<div class="w-100 bg-dark" style="height: 50px;">
</div>
<div class="row" >
<div class="col-6 bg-primary" style="height: 50vh;">
<div class="position-fixed bg-danger">
</div>
</div>
<div class="col-6 bg-secondary " style="height: 100vh;">
</div>
</div>
</div>
don't forget to put height and width
///
Other and I think better way :
<div class="container-fluid">
<div class="row">
<aside class="col-2 px-0 fixed-top bg-danger">
</aside>
<main class="col offset-2 h-100">
</main>
</div>
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I've designed the div below and I have no idea how to make it in bootstrap. I would like the div to be 10 columns wide and the images are svg images which are 64px wide and 48px tall. The text in the middle is the font Roboto from Google Fonts and is 20px in size. I would like the images and text to be vertically centered too.Image
My attempt: `
<div class="row">
<div class="col-sm-10 col-sm-offset-1 text-center">
<div class="col-sm-1 col-sm-offset-1">
<img src="img/breath.svg" width="64" height="46.64" class="img-responsive" alt="Breath">
</div><!-- col-sm-1 -->
<p>You have taken 500000 breaths</p>
</div><!-- col-sm-10 -->
</div><!-- row -->
A better approach to this might be to use bootstraps flexbox display class d-flex. I've taken your code and put it into a codeply project. There's more information about flexbox and how to use it in the bootstrap documentation located here.
HTML with Bootstrap 4:
<div class="container">
<div class="row d-flex justify-content-between align-items-center">
<img src="http://via.placeholder.com/64x48" alt="breath">
span class="align-middle">You have taken 5000000 breaths</span>
<img src="http://via.placeholder.com/64x48" alt="breath">
</div>
</div>
CSS:
.container {
position: absolute;
top: 50%;
left: 15%;
}
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I'm using bootstrap columns which allows a maximum of 12. I need two different divs in one row, one having 12 cols and the other 4. I need the one of 4 cols to appear on the one of 12. Means both of divs will be in the same row. Please how do I achieve this. Thanks.
First of all you can split main container to two columns, for example 50/50 and inside they you can put next columns.
<div class="container">
<div class="col-md-6>
<div class="col-md-3></div>
<div class="col-md-3></div>
<div class="col-md-3></div>
<div class="col-md-3></div>
</div>
<div class="col-md-6>
<div class="col-md-1></div>
<div class="col-md-1></div>
<div class="col-md-1></div>
<div class="col-md-1></div>
<div class="col-md-1></div>
<div class="col-md-1></div>
<div class="col-md-1></div>
<div class="col-md-1></div>
<div class="col-md-1></div>
<div class="col-md-1></div>
<div class="col-md-1></div>
<div class="col-md-1></div>
</div>
</div>
You can make it by following the below mentioned steps:
Go to Customize Bootstrap page.
Increase the value of #grid-columns variable from 12 to 16.
Compile and Download the modified css.
And then you will be able to use 16 columns in a row instead of 12 as shown below.
<div class="row">
<div class="col-xs-12"></div>
<div class="col-xs-4"></div>
</div>
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
How to delete the area under the navbar? I used the "margin-bottom: 0" and it's not working correctly.
just add .container class to your .wide div
<div class="wide container">
<h1>test</h1>
</div>
https://jsfiddle.net/grassog/1b0m6ztx/
use clearfix class with wide or just add overflow: hidden; in .wide to set h1 margin
<div class="wide clearfix">
<h1>test</h1>
</div>
or
.wide {
overflow: hidden;
}
Wrap all the content inside wide div with <div class="container"></div> to keep full width background image as it is in your screenshot.
<div class="wide">
<div class="container">
<h1>test</h1>
</div>
</div>
JSFiddle example
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have two divs that are col-xs-12 wide. There is no margin between them so they touch. I would like to add a border between them, like the image on the right (what I have currently is on the left).
I tried adding a 1 px height 11-wide column and centering it, but of course you can see a gap between the two rows on each side of the border.
Here's a jfiddle of the whole thing.
<div class="row top-buffer-10">
<div class="col-xs-12">
<div class="header-text">
<p style="font-size:130%"><b>%REGION%</b></p>
<p style="padding-bottom:15px;">(currently selected)</p>
</div>
</div>
</div>
<div class="row top-buffer-10">
<div class="col-xs-12">
<div class="img-with-text">
<img style="margin-top:5px;" src="img/gsd_list_contact.png" alt="itscl" />
<p style="font-size:90%;padding-left:0px;"><b>PHONE:</b> %LOCAL_PHONE%<br>
<b>TOLL FREE:</b> %TOLL_FREE%<br>
<b>LANGUAGE:</b> %LANGUAGE%
</p>
</div>
</div>
</div>
These are the two relevant divs to look out for.
There seems to be a little confusion, I want the border to be small than the div, as in, not just adding border top or border bottom.
See how the border doesn't quite reach the edges of the div. Thanks.
Here is a possible solution: https://jsfiddle.net/yjtrk00o/4/
EDIT:
add a css called division as shown below
In your HTML, add the line <hr class="division"/> just above the <div class="img-with-text">
CSS
.division{
border-top:1px solid #D3D3D3;
margin-top:0px;
margin-bottom:0px;
margin-left:10px;
margin-right:10px;
}
HTML
<div class="col-xs-12">
<hr class="division"/>
<div class="img-with-text">
I'm not sure if it's the desired effect you're after, but have you tried the following:
<div class="img-with-text" style="border-top: 1px solid black;">
Obviously you can fiddle with colour etc, or add that into the css class.
EDIT:
perhaps this then:
<div class="col-xs-12">
<div style="margin: 0 10px; display: block; height: 1px; background: #000;"></div>
<div class="img-with-text">
You can play with the margin to give you the offset from the edges you want. Probably not the most elegant solution, but seems to get the visual result you're after?