How do I make this div in bootstrap [closed] - html

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%;
}

Related

how to create one div as fixed and second scrollable? [closed]

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>

Issue with Bootstrap grid system and vertical aligning [closed]

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
Issue
I finally found an easy way of vertical aligning div elements and any other type of element, using the CSS properties/values display:flex; align-items: center. Only issue now is that the Boostrap grid system i.e. col-*-12 doesn't work. If I set a div to expand 12 columns when on a small screen, it doesn't react, in less I remove the styling used for vertically aligning the items.
Aim
To be able to use the grid system and vertically align elements. Any idea why display: flex is preventing the grid from working?
HTML
<div class="header-container padding-top--sm padding-bottom--sm">
<div class="row" style="display:flex;align-items:center">
<div class="col-xs-12 col-sm-6 col-md-3">
<img src="#" alt="logo">
</div>
<div class="col-xs-12 col-sm-6 col-md-6 text-md-center">
<p class="txt--white no-margin-bottom h-thin"> Lorem Ipsume, lorem ipsum</p>
</div>
<div class="col-xs-12 col-sm-6 col-md-3 text-md-right">
<span class="txt--white">support#support.com</span><br>
<span class="no-margin-bottom txt--white">001111111111 (8am - 8pm GMT)</span>
</div>
</div>
</div>
CSS
.padding-top--sm { padding-top: 1rem; }
.padding-bottom--sm { padding-bottom: 1rem; }
.header-container {
margin-left: auto;
margin-right: auto;
padding-left: 15px;
padding-right: 15px;
width: 90%;
}
The reason is because you are not letting your row "wrap" its contents.
By default its is set to nowrap value which means it does not allow the content to extend the container.
Try adding flex-wrap: wrap; property to your row style
<div class="row" style="display:flex;align-items:center;flex-wrap: wrap;">
...
</div>
Codepen here
PS: Consider avoiding inline styles, use external or atleast internal styles as much as possible

Positioning div's in html and CSS [closed]

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 have 5 div's as follows:
<div class="centered" style="background-color:red;">top</div>
<div style="background-color:orange;">left</div>
<div style="background-color:yellow;">center</div>
<div style="background-color:green;">right</div>
<div class="centered" style="background-color:blue;">bottom</div>
I want to place the first one (with centered class) on the top-center, and the second (with "left" text), third (with "center" text) and the fourth (with "right" text) in one row in the center right below the top. Lastly, the fifth (with centered class) in the bottom center below the line of 3 div's.
I tried but it was just a waste of time. Can you help me with css?
Like this?
div {
height: 200px;
display: border-box;
}
.centered {
margin: 0 auto;
width: 33.33%;
}
.row {
}
.row div {
width: 33.33%;
float: left;
}
.row:after {
display: table;
content: ' ';
clear: both;
}
<div class="centered" style="background-color:red;">top</div>
<div class="row">
<div style="background-color:orange;">left</div>
<div style="background-color:yellow;">center</div>
<div style="background-color:green;">right</div>
</div>
<div class="centered" style="background-color:blue;">bottom</div>
you may want to use a framework with a grid such as Twitter Bootstrap: http://getbootstrap.com/ or Zurb Foundation: http://foundation.zurb.com/. These frameworks provide a 12 column grid to make div positioning easier to handle.
The following example is using twitter bootstraps grid to position div's in the manner you are speaking of:
<div class="container">
<div id="top" class="row">
<div class="col-md-2 col-md-offset-5">
<p>...content</p>
</div>
</div>
<div id="middle" class="row">
<div class="col-md-4">
<p>...content</p>
</div>
<div class="col-md-4">
<p>...content</p>
</div>
<div class="col-md-4">
<p>...content</p>
</div>
</div>
<div id="bottom" class="row">
<div class="col-md-2 col-md-offset-5">
<p>...content</p>
</div>
</div>
</div>
The "row" class will create a new row where the elements will be positioned sort of like hitting enter for a new line in a word document. the "col-md-2" is the bootstrap syntax for how many columns the element will take up out of the 12 column grid. Offsetting this column by 5 on both ends will subtract 10 from the number of columns and so the remaining two in the middle will be reserved for the element. This will position your div in the center. You mentioned that you wanted the second row divs to all be positioned together in the center. The code written above will give each div equal width to take up the whole length of the row across the screen. The container that is wrapped around the code will provide a padding around all of the content inside of it so it will not touch the edges of the window. I hope this helps.

Boostrap Col vs Webkit Column [closed]

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

Custom thumbnail grid 3 columns? [closed]

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 8 years ago.
Improve this question
I'm trying to get this to work, I found this.
Instead of 4 columns, I want to keep the same height for 3 columns. How can I do this?
This is how it looks on my frontend:
x http://imagizer.imageshack.us/v2/150x100q90/661/TS8KVU.png
And it should be at 100% of the screen side by side images.
like this? or you want the image fill the div?:
<div class="col-md-4 no-pad">
<img class="img-responsive" src="//placehold.it/1280x640/eee">
</div>
<div class="col-md-4 no-pad">
<img class="img-responsive" src="//placehold.it/1280x640/eee">
</div>
<div class="col-md-4 no-pad">
<img class="img-responsive" src="//placehold.it/1280x640/eee">
</div>
.no-pad{
padding-left:0px;
padding-right:0px;
height:381px;
}
.no-pad img{
width:100%;
height:100%;
}