Responsive horizontal timeline into vertical timeline with bootstrap - html

I've tried looking up tutorials/examples/codepens like this but wasn't successful. Please link to any I might have missed.
I'm trying to make this image into html/css/Bootstrap, which shouldn't be so bad, except the vertical line might be a difficult (could use advice on this):
And then when you're changing the size of your browser or looking at it on portrait on a smartphone, I want it to look more like:
But I don't know how to go about doing this so that the circle and caption that correspond to each other in the horizontal timeline are also together on the vertical timeline.
Thank you so much for your help! Basic codepens would be super appreciated!

Try This
.Img1{
margin-top:30px;
position:relative;
}
.Img1:before{
content: "";
position: absolute;
left: 0;
right: 0;
height: 21px;
width: 1px;
background: red;
margin: 0 auto;
top: -26px;
}
.Img1 img{width:100%;border-radius:50%;width:100px;
height:100px;}
.Text2{
width:200px;
}
.Img2{
margin-bottom:30px;
position:relative;
}
.Img2:before{
content: "";
position: absolute;
left: 0;
right: 0;
height: 21px;
width: 1px;
background: red;
margin: 0 auto;
bottom: -26px;
}
.Img2 img{width:100%;border-radius:50%;width:100px;
height:100px;}
.container {
float: left;
margin: 0 10px;
text-align:center;
}
#media screen and (max-width: 767px) {
.container {
float: none;
clear: both;
margin:20px 0;
}
.container:after { content: "\00A0"; display: block; clear: both; visibility: hidden; line-height: 0; height: 0;}
.container{ display: inline-block;}
html[xmlns] .container { display: block;}
* html .container{ height: 1%;}
.container {display: block}
.Text1 {
float: right;
margin:30px 0;
}
.Img1 {
float: left;
margin-top:0;
}
.Text2 {
float: left;
margin:30px 0;
}
.Img2 {
float: right;
margin-bottom:30px;
}
.wrapper{width:60%;margin:0 auto;}
.Img2:before,.Img1:before{display:none;}
}
<div class="wrapper">
<div class="container">
<div class="Text1">
Idea formed
</div>
<div class="Img1">
<img src="https://www.nasa.gov/sites/default/files/styles/image_card_4x3_ratio/public/thumbnails/image/leisa_christmas_false_color.png">
</div>
</div>
<div class="container">
<div class="Img2">
<img src="https://www.nasa.gov/sites/default/files/styles/image_card_4x3_ratio/public/thumbnails/image/leisa_christmas_false_color.png">
</div>
<div class="Text2">
Private funding for prototype raise
</div>
</div>
</div>
Right now I have used image but you can create a div instead of image. And I have just created structure you need to modify this code.

Related

CSS Two grid DIVs, images and text gives me blackout

I've been playing with this grid for a while, it's a two grid system in which i'm trying to add two different images. I've added the images with success. However, It's when i try to make two separate containers for the text i would like to place over the images everything goes wrong. Been trying to wrap my head around this for hours without results.
I did succeed to add text over the image with the one column. However, these two columns just won't let me.
What is the best way to solve this?
CSS
/* SECTIONS */
.section-ad {
clear: both;
padding: 0px;
margin:0;
}
/* COLUMN */
.col {
display: block;
float:left;
margin: 0% 0% 0% 1%;
}
.col:first-child { margin-left: 0; }
/* GROUP */
.group:before,
.group:after { content:""; display:table; }
.group:after { clear:both;}
.group { zoom:1; /* For IE 6/7 */ }
/* TWO GRID */
.span_2_of_2 {
width: 100%;
height: auto;
}
.span_1_of_2 {
width: 49.5%;
height: auto;
}
.span_2_of_2 img {
width: 100%;
height: auto;
}
.span_1_of_2 img {
width: 100%;
height: auto;
}
/* GO FULL WIDTH AT LESS THAN 480 PIXELS */
#media only screen and (max-width: 480px) {
.col {
margin: 0% 0 0% 0%;
}
}
#media only screen and (max-width: 480px) {
.span_2_of_2, .span_1_of_2 { width: 100%; }
}
HTML
<div class="section-ad group">
<div class="col span_1_of_2">
<img src="https://cdn.shopify.com/s/files/1/0786/5107/files/main-sale-large.jpg?11274335160121521292" />
</div>
<div class="col span_1_of_2">
<img src="https://cdn.shopify.com/s/files/1/0786/5107/files/main-plain-x450_ab05c8e5-7269-4d98-b510-8ba5127db9c4.jpg?13010707129353802904" />
</div>
</div>
Best Regards,
Robin.
You can place text over image following way.
Add span inside col div and add text inside. And give position:absolute and parent div to position:relative;. Then you can set it's position using left and right value.
.section-ad {
clear: both;
padding: 0px;
margin:0;
}
/* COLUMN */
.col {
display: block;
float:left;
margin: 0% 0% 0% 1%;
position: relative;
}
.col:first-child { margin-left: 0; }
/* GROUP */
.group:before,
.group:after { content:""; display:table; }
.group:after { clear:both;}
.group { zoom:1; /* For IE 6/7 */ }
/* TWO GRID */
.span_2_of_2 {
width: 100%;
height: auto;
}
.span_1_of_2 {
width: 49.5%;
height: auto;
}
.span_2_of_2 img {
width: 100%;
height: auto;
}
.span_1_of_2 img {
width: 100%;
height: auto;
}
span {
color: #000000;
font-size: 25px;
left: 50%;
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
}
/* GO FULL WIDTH AT LESS THAN 480 PIXELS */
#media only screen and (max-width: 480px) {
.col {
margin: 0% 0 0% 0%;
}
}
#media only screen and (max-width: 480px) {
.span_2_of_2, .span_1_of_2 { width: 100%; }
}
<div class="section-ad group">
<div class="col span_1_of_2">
<img src="https://cdn.shopify.com/s/files/1/0786/5107/files/main-sale-large.jpg?11274335160121521292" />
<span>Some text</span>
</div>
<div class="col span_1_of_2">
<img src="https://cdn.shopify.com/s/files/1/0786/5107/files/main-plain-x450_ab05c8e5-7269-4d98-b510-8ba5127db9c4.jpg?13010707129353802904" />
<span>Some text</span>
</div>
</div>
Thanks to all your replies.
Ketan - Altough your solution worked, it did not fit my needs.
However, thanks to your reply i managed to surpass my blackout. So i owe it too you anyway. Thanks!
This might now be the best way,
but this is how i did it.
CSS
CSS
/* TVĂ… KOLUMN ADVERT # 705x450 */
.span_1_container {
position: absolute;
top: 80%;
left: 25%;
z-index: 0;
padding: 0;
padding: 1.2em;
font-size: .5em;
text-align: center;
width: 45%;
}
.span_1_heading {
font-size: 20px;
line-height: 100px;
display:inline-block;
position: relative;
}
.span_2_container h2:before {
content: '';
border-top: 1px solid #383a4f;
position: absolute;
width: 25%;
left: 35%;
top: 50px;
}
.span_2_container {
position: absolute;
top: 25%;
left: 0%;
z-index: 0;
padding: 0;
padding: 1.2em;
font-size: .5em;
text-align: center;
width: 45%;
}
.span_2_container h2:after {
content: '';
border-bottom: 1px solid #383a4f;
position: absolute;
width: 25%;
left: 35%;
bottom: 50px;
padding-bottom: 20px;
}
<div class="section-ad group">
<div class="col span_1_of_2">
<img src="https://cdn.shopify.com/s/files/1/0786/5107/files/main-sale-large.jpg?5000542013708637763" />
<div class="span_1_container">
SHOP NOW</div>
</div>
<div class="col span_1_of_2">
<img src="https://cdn.shopify.com/s/files/1/0786/5107/files/main-plain-x450_ab05c8e5-7269-4d98-b510-8ba5127db9c4.jpg?13010707129353802904" />
<div class="span_2_container">
<h2 class="span_2_heading" style="font-weight: normal; color: #383a4f;">Pocketsquares</h2>
<p style="font-family: 'Lato'; font-size: 14px; color: #383a4f; line-height: 15px; padding-bottom: 20px;">Explore our premium pocketsquares.</p>
SHOP NOW</div>
</div>
</div>

Perfectly Align 1 large Image with 2 small ones next two it in a flexible container

I want to achieve a flexible container with three images. One large one the left, two smaller ones (roughly one quarter of the size) aligned to the right of it:
When resizing the browser window, I want the three images to adjust accordingly while keeping the original proportions so the large image's baseline keeps aligned with the lower small image's baseline.
So far, I've tried the following code:
<div id="space">
<div id="large">
<img src="http://placehold.it/640x420" />
</div>
<div class="small">
<img src="http://placehold.it/320x200" />
</div>
<div class="small">
<img src="http://placehold.it/320x200" />
</div>
</div>
#space {
width:100%;
}
#large {
width:60%;
float:left;
margin:1% 1%;
padding:0px;
}
.small {
width:30%;
float:left;
margin:1% 1%;
padding:0px;
}
img {
width:100%;
height:auto;
padding:0px;
margin:0px;
}
In case the images are slightly higher than the proportions allow, the images should be vertically centered in the respective container, the overflow should be hidden.
You can find this code on JSFIDDLE: https://jsfiddle.net/u8kksgbq/12/
Please help - I've been trying and trying and don't find a solution.
Thanks for your answers. This my final solution:
<section id="contact-pics">
<div class="pic-large">
<div class="dummy"></div>
<div class="pic-content">
<img src="http://192.168.178.20"/>
</div>
</div>
<div class="v-spacer">
<div class="dummy"></div>
<div class="pic-content">
</div>
</div>
<div class="pic-small">
<div class="dummy"></div>
<div class="pic-content">
<img src="http://192.168.178.20"/>
</div>
</div>
<div class="h-spacer">
<div class="dummy"></div>
<div class="pic-content">
</div>
</div>
<div class="pic-small">
<div class="dummy"></div>
<div class="pic-content">
<img src="http://192.168.178.20"/>
</div>
</div>
</section>
And the CSS:
#contact-pics {
img {
width: 100%;
height: auto;
}
overflow: auto;
.pic-large {
display: inline-block;
position: relative;
width: 65.99%;
float:left;
.dummy {
padding-top: 62%;
}
}
.pic-small {
display: inline-block;
position: relative;
width: 32.8%;
float:left;
.dummy {
padding-top: 62%;
}
}
.v-spacer {
display: inline-block;
position: relative;
width: 1.2%;
float:left;
.dummy {
padding-top: 2535%;
}
}
.h-spacer {
display: inline-block;
position: relative;
width: 32.333333%;
float:left;
.dummy {
padding-top: 2.4%;
}
}
.pic-content {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
}
Guess there are easier solutions, but this one definitely works :-)
Fiddle
I don't know how much of an answer it is, but I gave it a try.
You have to put a vertical separator between small and large images, that way you can specify the "fake" margin between them in width: xx%;
As for horizontal separator, I tried it, but couldn't get it. The only solution that I can see is to create a transparent image and put between them. Set its width: 30% , just like the photos and that way it will keep the height: auto too.
Thanks for your question, I have tested some solutions and found the answer for # is the correct one, but the code isn't placed correctly. I have edited CSS as follow:
#contact-pics {
overflow: auto;
}
#contact-pics img {
width: 100%;
height: auto;
}
.pic-large {
display: inline-block;
position: relative;
width: 65.99%;
float:right;
}
.pic-large .dummy {
padding-top: 62%;
}
.pic-small {
display: inline-block;
position: relative;
width: 32.8%;
float:right;
}
.pic-small .dummy {
padding-top: 62%;
}
.v-spacer {
display: inline-block;
position: relative;
width: 1.2%;
float:right;
}
.v-spacer .dummy {
padding-top: 2535%;
}
.h-spacer {
display: inline-block;
position: relative;
width: 32.333333%;
float:right;
}
.h-spacer .dummy {
padding-top: 2.4%;
}
.pic-content {
position: absolute;
/*top: 0;*/
bottom: 0;
left: 0;
right: 0;
}

Unable to bottom align a image within a div, which is inside another div

Still looking for solution:
updated jsfiddle 2: http://jsfiddle.net/sharath83/hyaswq1f/6/
**css**
body { margin: 0; font-size: 1em; line-height: 1.4; }
.fluid {
clear: both;
margin-left: 0;
width: 100%;
float: left;
display: block;
}
.gridContainer {
width: 68.6%;
max-width:960px;
/*max-width: 1232px;*/
padding-left: 0.75%;
padding-right: 0.75%;
margin: auto;
clear: none;
float: none;
margin-left: auto;
}
.clearfix:before, .clearfix:after { content: ""; display: table; }
.clearfix:after { clear: both; }
.clearfix { *zoom: 1; }
.responsive-scale-homepage1{
width:100%;
padding-bottom: 66.666666666667%; /* 960px/1440px */
background-image:url(images/homepage-main-1.jpg);
background-size:100%;
background-position:center; /* IE fix */
display:block;
background-repeat:no-repeat;
background-color:#B99394;
}
.clear {
clear:both;
margin:0px;
padding:0px;
}
.arrow_wrapper{
vertical-align:bottom;
display:table-cell;
}
.db_arrow{
content:url(images/dark-blue-arrow.png);
background-color:#AD3E40;
}
html
<div class="fluid body responsive-scale-homepage1">
<div class="arrow_wrapper">
<div class="db_arrow"></div>
</div>
</div>
</div>
In the above jsfiddle i tried making what i am looking for. There is an arrow (facing downwards, which when clicked will scroll down to next image), aligned it to bottom of a background image and middle to it.
But am not able to align it bottom and center/middle. It doesn't fit in for any of the screens too, mobile/tab/desktop. This is for a responsive web!
Can anyone help me on this one please, thank you.
Use background-position:center bottom;
DEMO
body {
margin: 0;
font-size: 1em;
line-height: 1.4;
}
.fluid {
clear: both;
margin-left: 0;
width: 100%;
float: left;
display: block;
}
.responsive-scale-homepage1 {
width: 100%;
padding-bottom: 66.666666666667%;
/* 960px/1440px */
background-image: url(http://placekitten.com/g/300/300);
background-size: 100%;
background-position: center bottom;
/* IE fix */
background-size: auto;
display: block;
background-repeat: no-repeat;
background-color: #A6A6A6;
}
.clear {
clear: both;
margin: 0px;
padding: 0px;
}
.arrow_wrapper {
position: absolute;
vertical-align: bottom;
height: 40%;
width: 50%;
top: 80%;
}
.db_arrow {
content: url(images/dark-blue-arrow.png);
position: absolute;
width: 2.5%;
vertical-align: bottom;
margin: auto auto;
background-color: #AD3E40;
}
<div class="fluid body responsive-scale-homepage1">
<div class="clear arrow_wrapper">
<a href="#transparency">
<div class="db_arrow"></div>
</a>
</div>
</div>
As for aligning your arrow, is this what you were looking for?
I don't know the dimension of your arrow image but here's a solution for you.
Fiddle
Added position: absolute; bottom: 0; to your .arrow-wrapper to get the arrow to the bottom and then on your db_arrow class I specified a width and used margin: auto; to center the image.
body {
margin: 0;
font-size: 1em;
line-height: 1.4;
}
.fluid {
clear: both;
margin-left: 0;
width: 100%;
float: left;
display: block;
position: relative;
}
.gridContainer {
width: 68.6%;
max-width:960px;
/*max-width: 1232px;*/
padding-left: 0.75%;
padding-right: 0.75%;
margin: auto;
clear: none;
float: none;
margin-left: auto;
}
.clearfix:before, .clearfix:after {
content:"";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
*zoom: 1;
}
.responsive-scale-homepage1 {
width:100%;
padding-bottom: 66.666666666667%;
/* 960px/1440px */
background-image:url(images/homepage-main-1.jpg);
background-size:100%;
background-position:center;
/* IE fix */
display:block;
background-repeat:no-repeat;
background-color:#B99394;
}
.clear {
clear:both;
margin:0px;
padding:0px;
}
.arrow_wrapper {
position: absolute;
width: 100%;
bottom: 0;
}
.db_arrow {
content:url(images/dark-blue-arrow.png);
width: 200px;
margin: auto;
background-color:#AD3E40;
}
<div class="gridContainer clearfix">
<div class="fluid body responsive-scale-homepage1">
<div class="arrow_wrapper"> <div class="db_arrow"></div>
</div>
</div>
</div>

how to align div's horizontally in CSS

I have three child divs inside a container and I want to align these div's horizontally. I tried using the css float property but the circles are becoming oval.
Markup Code:
<div class="container info-box clearfix">
<div class="circle">
<div class="content">
<h3>Learn at your own Pace</h3>
</div>
</div>
<div class="circle">
<div class="content">
<h3>Methodic learning</h3>
</div>
</div>
<div class="circle">
<div class="content">
<h3>Unique Approach</h3>
</div>
</div>
</div>
CSS:
.circle {
position: relative;
background-color: #3cb371;
border-radius: 50%;
padding: 5px 10px;
width: 20%;
}
.content {
position: absolute;
top: 0; right: 0; bottom: 0; left: 0;
overflow: auto;
}
.circle:before {
content: '';
display: block;
margin-top: 100%; /* 1:1 ratio */
}
.clearfix:before, .clearfix:after{
content: " ";
display: table;
}
.clearfix:after{
clear: both
}
.info-box{
margin-top: 20px;
width:100%;
}
.container{
margin-left: auto;
margin-right: auto;
padding-left:15px;
padding-right:15px;
text-align:center;
}
*{
box-sizing: border-box;
}
I tried using the float property but the circles are turning into oval. Please let me know where I am going wrong.
Code on jsfiddle: jsfiddle
Circles are becoming oval because of padding property you have applied. just remove padding: 5px 10px; and add float:left; in the circle class.
.circle {
position: relative;
background-color: #3cb371;
border-radius: 50%;
float: left;
width: 20%;
}
Please use display: inline-block;
http://jsfiddle.net/K6PKK/
try this:
div.clearfix {
display : table;
}
div.circle {
display : table-cell;
}

Float a DIV toward bottom-right using CSS

I have three DIV and inside the DIV, I would like to float the "Learn More" to bottom right so it will be on top of the grey background.
CSS
/* the div for LEARN MORE */
#trt {
z-index: 9999999999999;
position: relative;
float: right;
bottom: 0; // not working
top: 12; //not working
}
/* the entire div */
.main .cols { padding-left: 2px; padding-right: 0px; padding-top: 10px; }
.main .cols .col { width: 315px; height: 108px; float: left; background: url(images/tempf.png) no-repeat 0 0; }
.main .cols .col:after { content:''; width: 100%; clear: both; }
.main .cols .col + .col { padding-left: 20px; }
.main .cols .col img.hid { float: left; width: 129px; height: 108px; }
.main .cols .col-cnt { width: 183px; float: right; }
.main .cols .col .more { font-weight: bold; color: #0206AA; }
HTML
<div class="main">
<section class="cols">
<div class="col">
<a href="link.aspx">
<img class="hid" src="css/images/orgNews.png" alt="" />
</a>
<div class="col-cnt">
<h3 style="color: #FFFFFF;">Organization News</h3>
<p style="color: #FFFFFF;">Interfaith Medical Center related news and updates</p>
<div id="trt">
<img src="css/images/arrow.png" width=11 height=11 align=absmiddle />
Learn More
</div>
</div>
</div>
</section>
</div>
CSS - After Edit
.trt {
z-index: 9999999999999;
position: absolute;
bottom: 3px;
right: 3px;
}
...
.main .cols .col-cnt { width: 183px; float: right; position: relative; }
...
This CSS worked:
.trt {
z-index: 9999999999999;
position: absolute;
top: 85px;
right: 3px;
}
set col-cnt div to position: relative set trt to position: absolute; bottom:3px; right:3px; that should get you where you need to be.. also, trt should be a class if it is being reused
First at all, you must set parent of #trt to relative.
#parent-of-trt {
position: relative;
}
And set #trt to absolute
#trt {
position: absolute;
left: 4px;
bottom: 5px;
}
Your float: right isn't working because of a width issue on the #trt div. Basically it's extending 100% of the width and so it can't technically go left or right. Instead of floating, just use...
#trt { text-align: right; }
???
As for getting it pushed down onto that grey line, add some margin-top to #trt to do that...
Other solution would be to use position: absolute; but would be less preferable.
Maybe use position: absolute; instead of relative
change position as fixed like following:
position:fixed;
it should work.