Bootstrap with five images with same row - html

I m expecting like this image Link
In the image there 5 images and link to dotted images..
May i know, How to display with using bootstrap classes.
I just confused, can anyone help me to fix this?
Thanks,
Here is the code by using table tag:
<td class="tdbodycontent" id="workDemo">
<div class="wrapper" style="height:340px;">
<table class="tblhomecontent dotted" cellpadding="0" cellspacing="0">
<tbody><tr>
<td colspan="5">
<div class="boxtitle">
How it works</div>
</td>
</tr>
<tr>
<td class="box5col">
<div class="marker_1 center">
</div>
<p class="markerContent">
Sign Up for free</p>
</td>
<td class="box5col">
<div class="marker_2 center">
</div>
<p class="markerContent">
Select the<br>
neighborhoods<br>
you want to follow</p>
</td>
<td class="box5col">
<div class="marker_3 center">
</div>
<p class="markerContent">
Invite friends and<br>
family to join</p>
</td>
<td class="box5col">
<div class="marker_4 center">
</div>
<p class="markerContent">
Receive important<br>
alerts and information<br>
from trusted sources</p>
</td>
<td class="box5col">
<div class="marker_5 center">
</div>
<p class="markerContent">
Share information<br>
with friends<br>
securely</p>
</td>
</tr>
</tbody></table>
</div>
</td>
I need to convert in bootstrap, Here is the image link dotted , step-1 , step-2 , step-3 , step-4 , step-5

This may work for you.
or you need to write a custom media css style to achieve this.
<div class="row">
<div class="col-md-2 col-md-offset-1"><img src="images/sample.jpg"></div>
<div class="col-md-2"><img src="images/sample.jpg"></div>
<div class="col-md-2"><img src="images/sample.jpg"></div>
<div class="col-md-2"><img src="images/sample.jpg"></div>
<div class="col-md-2"><img src="images/sample.jpg"></div>
</div>

Building on top of anu g prem's solution, and adding something for the dotted lines, plus a bit of explanations.
Live example
<div class="container">
<div class="row steps">
<hr class="col-xs-8 col-xs-offset-2" />
<div class="col-xs-2 col-xs-offset-1"><img src="http://s22.postimg.org/pq17qfgwd/step_1.png" class="img-responsive"></div>
<div class="col-xs-2"><img src="http://s22.postimg.org/5u58avzv1/step_2.png" class="img-responsive"></div>
<div class="col-xs-2"><img src="http://s22.postimg.org/58g9es4st/step_3.png" class="img-responsive"></div>
<div class="col-xs-2"><img src="http://s22.postimg.org/576bld2z1/step_4.png" class="img-responsive"></div>
<div class="col-xs-2"><img src="http://s22.postimg.org/g9bejsx1p/step_5.png" class="img-responsive"></div>
</div>
</div>
.steps {
position: relative;
}
.steps hr {
/* Use the 3 lines below to use a dotted line image file as background of the <hr> */
border: none;
background: transparent url('http://s22.postimg.org/53ci53xht/dotted.png') no-repeat center center;
height: 2px;
/* Use the line below instead to style the <hr> with a border */
/*border-top: 1px dashed gray;*/
margin-top: 0;
margin-bottom: 0;
position: absolute;
top: 50%;
}
.steps .img-responsive {
margin: 0 auto;
}
You'll notice I did not use your dotted line, and instead used an <hr>, and styled its border-top with a dashed line. (Edit: but op wants to use the image he provided, see comments.)
To answer your question regarding the number of columns (10 vs Bootstrap grid's 12), you need to understand that you don't always have to fill all the twelve columns. Here, we're using 2 columns per image, plus a first column as offset, and you get your five images, centered, with one offset column on the left, and an empty column on the right, and it's fine!
Note that I used img-responsive class to ensure your images never grow too big, outside of their 2 columns, and that I used xs (meaning "extra small") in the class col-xs-2, which means all device screen sizes will get the five images on the same line (and resized to fit), which might not be want you want for smaller devices...

Related

how to set image and info side by side in css

I am stuck in a problem when am trying to set image and text side by side then its not shown perfect , checkout below I shared my code.
This is my image
https://ibb.co/SKS3bJM
i want like this
https://ibb.co/RhFkbkX
index.html
<div class="container">
<div class="row">
<div class="col-md-4 mt-2">
<img src="Images/twitter.jpg" style="width: 200px;">
<div style="margin-top: 10px;">
<h4>Should Twitter Get Rid of Follower Counts?</h4>
<p>The possibility feels closer than ever</p>
<p>Cool Neha in All Things Creative</p>
<p><b>JAN 9. 5 min read</b></p>
</div>
</div>
<div class="col-sm-4">
<div class="row" style="display: flex; flex-direction: column;" style="height: 50px;">
<div class="col-sm-4" style="display: flex; ">
<img src="Images/html.jpg" style="width: 100px; height: 100px;">
<p>Html, a standardized system for tagging text files to achieve font, colour, graphic, and hyperlink effects on WWW pages.</p>
</div>
<div class="col-sm-4" style="display: flex;">
<img src="Images/cs.png" style="width: 100px; height: 100px;">
<p>Html, a standardized system for tagging text files to achieve font, colour, graphic, and hyperlink effects on WWW pages.</p>
</div>
<div class="col-sm-4" style="display: flex;">
<img src="Images/js.png" style="width: 100px; height: 100px;">
<p>Html, a standardized system for tagging text files to achieve font, colour, graphic, and hyperlink effects on WWW pages.</p>
</div>
</div>
</div>
<div class="col-sm-4 mt-2">
<img src="Images/cofee.png" style="width: 350px;">
<div style="margin-top: 10px;">
<h4>No,That's Not How You Say It.</h4>
<p>A short Personal history of my favourite fast Food.</p>
<p>VIP Singh</p>
<p><b>JAN 29. 8 min read</b></p>
</div>
</div>
</div>
</div>
It looks like the center column is being squished too much. This is because each image-text pair was inside a div with class="col-sm-4". This was making the div too narrow. If you remove the class, the problem will disappear.
This is the resulting code:
<div class="container">
<div class="row">
<div class="col-md-4 mt-2">
<img src="Images/twitter.jpg" style="width: 200px;">
<div style="margin-top: 10px;">
<h4>Should Twitter Get Rid of Follower Counts?</h4>
<p>The possibility feels closer than ever</p>
<p>Cool Neha in All Things Creative</p>
<p><b>JAN 9. 5 min read</b></p>
</div>
</div>
<div class="col-md-4">
<div class="row" style="display: flex; flex-direction: column;" style="height: 50px;">
<div class="" style="display: flex; ">
<img src="Images/html.jpg" style="width: 100px; height: 100px;">
<p>Html, a standardized system for tagging text files to achieve font, colour, graphic, and hyperlink effects on WWW pages.</p>
</div>
<div class="" style="display: flex;">
<img src="Images/cs.png" style="width: 100px; height: 100px;">
<p>Html, a standardized system for tagging text files to achieve font, colour, graphic, and hyperlink effects on WWW pages.</p>
</div>
<div class="" style="display: flex;">
<img src="Images/js.png" style="width: 100px; height: 100px;">
<p>Html, a standardized system for tagging text files to achieve font, colour, graphic, and hyperlink effects on WWW pages.</p>
</div>
</div>
</div>
<div class="col-sm-4 mt-2">
<img src="Images/cofee.png" style="width: 350px;">
<div style="margin-top: 10px;">
<h4>No,That's Not How You Say It.</h4>
<p>A short Personal history of my favourite fast Food.</p>
<p>VIP Singh</p>
<p><b>JAN 29. 8 min read</b></p>
</div>
</div>
</div>
</div>

Horizontally aligning a h3 and h5

I am trying to use bootstrap to align my h3 headings with my h5 so that they are in line with each other.
EDIT
I am trying to use the already available bootstrap and avoid changing the css unless absolutely necessary.
Here is a screen to demonstrate what i mean.
E.g. First name should line up with address 1, last name with address 2 etc.
here is the code I have.
<div class="row ">
<div class="col-md-4 ">
<h3>First Name</h3>
<h3>Last Name</h3>
<h3>Week.</h3>
<h3>Code.</h3>
</div>
<div class="col-md-4 ">
<h5>Address 1</h5>
<h5>Address 2</h5>
<h5>Address 3</h5>
<h5>Country</h5>
</div>
</div>
That's not what headers are for. (semantically incorrect, search engines won't like this)
I suggest to simply use a table for this (it IS tabular data) and use different CSS rules for td:first-child and td:nth-child(2) in order to get the different font sizes.
.x {
width: 100%;
}
.x td {
padding: 10px;
font-family: sans-serif;
font-weight: light;
}
.x td:first-child {
font-size: 24px;
width: 60%;
}
.x td:nth-child(2) {
font-size: 16px;
width: 40%;
}
<table class="x">
<tr>
<td>First Name</td>
<td>Address 1</td>
</tr>
<tr>
<td>Last Name</td>
<td>Address 2</td>
</tr>
<tr>
<td>Week.</td>
<td>Address 3</td>
</tr>
<tr>
<td>Code.</td>
<td>Country</td>
</tr>
</table>
Better not to mess with the h3/h5 heights, and use multiple rows instead. E.g. what if one of the texts becomes so long that it wraps? Then you can say bye-bye to your aligned layout. That will never happen if you use multple rows:
<div class="row">
<div class="col-md-4">
<h3>First Name</h3>
</div>
<div class="col-md-4">
<h5>Address 1</h5>
</div>
</div>
<div class="row">
<div class="col-md-4">
<h3>Last Name</h3>
</div>
<div class="col-md-4">
<h5>Address 2</h5>
</div>
</div>
<div class="row">
<div class="col-md-4">
<h3>Week.</h3>
</div>
<div class="col-md-4">
<h5>Address 3</h5>
</div>
</div>
<div class="row">
<div class="col-md-4">
<h3>Code.</h3>
</div>
<div class="col-md-4">
<h5>Country</h5>
</div>
</div>
Apart from all this: I agree with the remarks by others that you shouldn't be using h3/h5 in the first place. Headers are intended to define relations between logical units of text, so <h5> is the header of a sub-sub section of text inside a chapter of text that is headed by a <h3> tag.
set same line-heigt, margins, and padding for h3&h5 in css styles

laying out divs horizontally with content within it

I am trying to layout my div holding three divs within it. The application uses Bootstrap. They don't seem to be laying out properly with all text or buttons in the center. I am using a separator between the second and third boxes. The application also uses another class content-header which is from the proui library used elsewhere in the application and borrowed here for maintaining the same look and feel across the application.
This is the simplified HTML
<!--FIXED PANEL-->
<div class="content-header fd">
<!-- first box-->
<div class="col-md-6 fdc" style="display:block; visibility:visible">
first box
</div>
<!--second box-->
<div class="col-md-2 fdc" >
second box
<span class="pipe_separator">|</span>
</div>
<!--third box-->
<div class="col-md-4 fdc text-left">
third box
</div>
</div>
Here is the CSS
.fd{
position: fixed;
top: 70px;
width:100%;
background-color: #141313ad;
z-index: 1
}
.fdc{
display: inline-block;
*display: inline; zoom: 1;
vertical-align:middle;
background-color: #141313e5;
height: 75px;
border-color: black;
}
.pipe_separator{
font-size: 40px;
}
}
</style>
here is what it looks like
As you can see the content of the boxes are not aligned. I want the third div and its contents to be where I have drawn it out with the number 3 within. The separator just about to its left where I have drawn the green line and the second div to the left of the separator and the first div to the left of the second div. The main div holding these three layers acts as a fixed panel below the page header. How do I make them align together and sit as I have described.
Simplest hack is to put them in a table with no borders. It will work as follows:
<div class="content-header fd">
<table borders="0">
<tr><td>
<!-- first box-->
<div class="col-md-6 fdc" style="display:block; visibility:visible">
first box
</div>
</td>
<td>
<!--second box-->
<div class="col-md-2 fdc" >
second box
<span class="pipe_separator">|</span>
</div>
</td>
<td>
<!--third box-->
<div class="col-md-4 fdc text-left">
third box
</div>
</td>
</tr>
</table>
</div>

How to place two elements side by side in one div? [duplicate]

This question already has answers here:
Float 2 elements side by side inside a container div
(2 answers)
Closed 3 years ago.
I have loop that goes trough all pictures that I have and displays them. I would like to display them in one row, from left to right, but with css that I have is displaying them one under other. I have use flow but not sure if I used it correctly.
Here is my code:
.column.is-narrow {
float: right;
}
.box {
float: right;
}
<div class="column">
<div class="columns" ng-repeat="a in $ctrl.f">
<div class="column is-narrow">
<div class="box" style="width: 200px;">
<p class="title is-5">{{album}}</p>
<figure class="image is-128x128">
<!--<img ng-src="{{src}}"> remove and replaced for demo purpose-->
<img src="http://dummyimage.com/128x128" />
</figure>
<p class="subtitle">{{person}}</p>
</div>
</div>
</div>
I am aware that my css is not correct I have been searching for answer but couldn't find it.
Basically, when you float things, they'll still wrap if there isn't enough space to display both side by side. The easiest solution is to set a width on them to ensure that their container will always be wide enough to fit the content. You can do it with percentages or pixels, depending on your use case.
Note: If you use percentages, percentages adding up to 100% may still cause it to wrap, because they may not take into account padding, margin and/or border depending on other things. I usually do something like 49% for both, then float one right and one left.
You may use display and mind this inline-style <div class="box" style="width: 200px;"> wich is to start with, not wide enough to hold texts and img side by side
display:table/table-cell;
.column.is-narrow {
float: right;
}
.box {display:table;}
.box> p, .box> figure {display:table-cell;vertical-align:middle/* or top or else */
}
<div class="column">
<div class="columns" ng-repeat="a in $ctrl.f">
<div class="column is-narrow">
<div class="box" style="width: 200px;">
<p class="title is-5">{{album}}</p>
<figure class="image is-128x128">
<!--<img ng-src="{{src}}"> remove and replaced for demo purpose-->
<img src="http://dummyimage.com/128x128" />
</figure>
<p class="subtitle">{{person}}</p>
</div>
</div>
</div>
display:flex;
.column.is-narrow {
float: right;
}
.box {
display: flex;
/* removed width:200px from inline-style*/
}
p {
margin: auto;
}
<div class="column">
<div class="columns" ng-repeat="a in $ctrl.f">
<div class="column is-narrow">
<div class="box">
<p class="title is-5">{{album}}</p>
<figure class="image is-128x128">
<!--<img ng-src="{{src}}"> remove and replaced for demo purpose-->
<img src="http://dummyimage.com/128x128" />
</figure>
<p class="subtitle">{{person}}</p>
</div>
</div>
</div>
The easiest way is to declare the parent div as a flex container by setting the property display: flex and flex-direction:row. If you don't want to wrap your pictures, you can set flex-wrap:nowrap.
Here http://the-echoplex.net/flexyboxes/ is nice playground for flex box.
So I found the answer and it was pretty simple :)
I just had to add one more div with class with which I will float it to left. This is what I wanted:
.html
<div class="column">
<div class="columns">
<div class="float" ng-repeat="a in $ctrl.f"> /* added this line of code */
<div class="column is-narrow">
<div class="box" style="width: 200px;">
<p class="title is-5">{{album}}</p>
<figure class="image is-128x128">
<!--<img ng-src="{{src}}"> remove and replaced for demo purpose-->
<img src="http://dummyimage.com/128x128" />
</figure>
</div>
</div>
<p class="subtitle">{{person}}</p>
</div>
</div>
</div>
.css
.float{
float:left;
}
That was it. It's working. :)

Is it possible to layout span/div in this way?

Im generating a table in php, and would like it in the top left of the screen.
The table varies slightly in width so directly to the right of it should go two blocks of text (text1, text2) and a third text (text3) which floats in the topmost right of the screen.
Below the three texts should be text4.
Requirements:
Text1 needs to always be to the right of the table.
text4 always needs to be below the top 3 texts.
I uploaded an image with the span/div/table/text and have literally been trying to arrange these for about 1.5 hours now. it seems like it should be really simple but im struggling with my requirements and one of them always seems to misalign. (all the 'texts' are just pieces of html text (not <input type=text or <textarea>)
Edit: Thankyou, is it possible without using libraries or bootstrap?
If you don't like using <table> tags for layouts, and don't like an extra large dependency to your project (like bootstrap), one could go for the following option:
<div class="table">
Table
</div>
<div class="text-container">
<div class="text1">
Text1
</div>
<div class="text2">
Text2
</div>
<div class="text3">
Text3
</div>
<div class="text4">
Text4
</div>
</div>
It is crucial that the display type of .table, .text-container and .text{1,2,3} are all display: inline-block;. This will make them inline. However, to force wrapping of .text4, this will still have to be display: block;.
https://jsfiddle.net/nnLofpL1/
Like hjardine uses in his example: it may also be a good idea to look to the clear property.
However it is not the nicest solution, the classic "table in table" does the job:
<table>
<tr>
<td>
<table>
<tr>
<td>PHP generated data</td>
</tr>
</table>
</td>
<td>
<table>
<tr style="height: 60px;">
<td>Text 1</td>
<td style="padding-left: 100px;">Text 2</td>
<td style="width: 200px; text-align: right;">Text 3</td>
</tr>
<tr style="height: 60px;">
<td colspan="3">Text 4</td>
</tr>
</table>
</td>
</tr>
</table>
https://jsfiddle.net/jrrfbqfk/
I can see you don't want to use bootstrap so i have updated an answer so that you don't have to use a table either, exact same output but without the problems of using a table for output.
.div1{float:left;width:40%;border:1px solid #000;min-height:200px;}
.div2{float:right;width:58%;border:1px solid #000;min-height:200px;}
.row1{min-height:100px;}
.sp1{float:left;width:30%;padding:4px;border:1px solid #000;min-height:60px;}
.sp2{float:left;width:30%;padding:4px;border:1px solid #000;min-height:60px;}
.sp3{float:right;width:30%;text-align:right;padding:4px;border:1px solid #000;min-height:60px;}
.divRow{width:100%;border: 1px solid #000;}
<div>
<div class="div1">
<div class="divRow">1</div>
<div class="divRow">2</div>
<div class="divRow">3</div>
<div class="divRow">4</div>
<div class="divRow">5</div>
<div class="divRow">6</div>
</div>
<div class="div2">
<div>
<div class="row1">
<div class="sp1">1</div>
<div class="sp2">2</div>
<div class="sp3">3</div>
<div style="clear:both;"></div>
</div>
<div class="row2" style="border:1px solid #000;min-height:40px;">
sadsadsad
</div>
</div>
</div>
<div style="clear:both;">
</div>
</div>
An easy solution to laying out a page so that things are where you want them is using bootstrap, because of the grid layout in bootstrap you can keep things in the same relative positions no matter what the size of the page is.
For what you want to do i think it would benefit you greatly.
EXAMPLE
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<div class="Container">
<div class="row">
<div class="col-xs-2">
Top left
</div>
<div class="col-xs-2 col-xs-offset-8">
Top right
</div>
</div>
</div>
This is a link to Bootstrap which is well worth learning IMHO!