Increase height on hover and push elements top and bottom - html

I have 3 equal elements on the page (33.333% height each), when the user hovers over one of the elements I would like the height of that element to grow to 100%.
The first section works as I'd like it to, the 2nd section I would like it to grow from the top and bottom, pushing the elements above and below off of the screen - I can do this with absolute positioning, but then the elements above and below stay in the same place and the element grows over them (with the right z-index).
I've tried scaling the element, and using borders that increase/decrease, however I will be using background images and potentially videos so this won't work.
Here is a jsfiddle of what I have currently:
body {
height: 100%;
overflow: hidden;
}
.home-split {
height: 100vh;
}
.home-split .item {
height: 33.333%;
width: 100%;
transition: all 1s;
z-index: 999;
text-align: center;
}
.h-100 {
height: 100%;
}
.home-split .item:hover {
height: 100%;
transition: all 1s;
z-index: 9990;
top: 0 !important;
}
.home-split .item .title {
align-self: center;
}
.home-split .item a {
text-decoration: none;
color: #FFF;
display: table;
height: 100%;
width: 100%;
}
.home-split .item a h2 {
display: table-cell;
vertical-align: middle;
}
.home-split .item:nth-child(1) {
background-color: #000;
}
.home-split .item:nth-child(2) {
background-color: #d7d7d7;
}
.home-split .item:nth-child(3) {
background-color: #ebebeb;
}
<section class="home-split">
<div class="row no-gutters item">
<div class="col-12 text-center h-100">
<a href="#">
<h2>Item 1</h2>
</a>
</div>
</div>
<div class="row no-gutters item">
<div class="col-12 text-center h-100">
<a href="#">
<h2>Item 2</h2>
</a>
</div>
</div>
<div class="row no-gutters item">
<div class="col-12 h-100">
<a href="#">
<h2>Item 3</h2>
</a>
</div>
</div>
</section>
https://jsfiddle.net/d81mxuL5/

You need a less specific selector to hide all sections when the outer container is hovered:
.home-split:hover .item {
height: 0;
overflow: hidden;
}

friend I use JQuery to achive
$(".item").hover(function() {
$(this).siblings().css( "height", "1px");
$(this).css( "height", "98%");
}, function() {
$(this).siblings().css( "height", "33%");
$(this).css( "height", "33%");
});
body {
height: 100%;
overflow: hidden;
}
.home-split {
height: 100vh;
}
.home-split .item {
height: 33.333%;
width: 100%;
transition: all 1s;
z-index: 999;
text-align: center;
overflow: hidden
}
.h-100 {
height: 100%;
}
.home-split .item:hover {
height: 100%;
transition: all 1s;
z-index: 9990;
top: 0 !important;
}
.home-split .item .title {
align-self: center;
}
.home-split .item a {
text-decoration: none;
color: #FFF;
display: table;
height: 100%;
width: 100%;
}
.home-split .item a h2 {
display: table-cell;
vertical-align: middle;
}
.home-split .item:nth-child(1) {
background-color: #000;
}
.home-split .item:nth-child(2) {
background-color: #d7d7d7;
}
.home-split .item:nth-child(3) {
background-color: #ebebeb;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<section class="home-split">
<div class="row no-gutters item">
<div class="col-12 text-center h-100">
<a href="#">
<h2>Item 1</h2>
</a>
</div>
</div>
<div class="row no-gutters item">
<div class="col-12 text-center h-100">
<a href="#">
<h2>Item 2</h2>
</a>
</div>
</div>
<div class="row no-gutters item">
<div class="col-12 h-100">
<a href="#">
<h2>Item 3</h2>
</a>
</div>
</div>
</section>

Related

Content won't overflow even with CSS property

I'm having trouble to make the content scroll in smaller viewport even with overflow property. My goal is to maintain the size of each image box and with the ability to scroll horizontally when the viewport is minimized.
.block-content {
width: 100%;
height: 100%;
}
.block-content .even-content {
display: flex;
position: relative;
width: 100%;
margin: 0 auto;
overflow: auto;
white-space: nowrap;
}
.even-content>* {
flex: 1;
}
.container {
position: relative;
overflow: hidden;
height: 100%;
width: 100%;
}
.image {
width: 100%;
height: 100%;
transition: all .5s ease;
object-fit: cover;
object-position: center;
}
.card-text {
padding: 3.75rem;
position: absolute;
z-index: 1;
left: 0;
bottom: 0;
}
.card-text h3 {
color: white;
margin-bottom: 2rem;
font-size: 2.25rem;
}
.card-text .fa-arrow-right {
margin-right: 10px;
}
.container:hover .image {
transform: scale(1.03);
}
<section class="block-content">
<div class="even-content scroll-menu">
<div class="container">
<img src="https://cdn.shopify.com/s/files/1/0598/5071/9391/files/homepage_update_september_23_04_900x.png?v=1663942261 alt=" " class="image ">
<div class="card-text ">
<h3>Pack Heavy <br><i class="fa-solid fa-arrow-right "></i>Chase Light</h3>
<button class="button ">Watch Now</button>
</div>
</div>
<div class="container ">
<img src="https://cdn.shopify.com/s/files/1/0598/5071/9391/files/homepage_us_au_mid_august_04_900x.png?v=1660903200 " alt=" " class="image ">
<div class="card-text ">
<h3>Midnight Sun</h3>
<button class="button ">Shop</button>
</div>
</div>
<div class="container ">
<img src="https://cdn.shopify.com/s/files/1/0598/5071/9391/files/homepage_update_september_23_05_ecfb361d-bd54-4d01-b9f1-0669bfd82552_900x.png?v=1663943416 " alt=" " class="image ">
<div class="card-text ">
<h3>SS22</h3>
<button class="button ">Shop</button>
</div>
</div>
</div>
</section>
Return to post
Your issue comes from this block:
.even-content>* {
flex: 1;
}
flex is a shorthand for the following CSS properties:
flex-grow
flex-shrink
flex-basis
Those blocks are similar:
.even-content>* {
flex: 1;
}
.even-content>* {
flex-grow: 1;
flex-shrink: 1;
flex-basis: 0%;
}
So, what is happening?
flex-shrink
The flex-shrink CSS property sets the flex shrink factor of a flex item. If the size of all flex items is larger than the flex container, items shrink to fit according to flex-shrink.
flex-shrink - MDN
You're telling your .even-content>* that they should shrink without having a minimum width.
What can you do?
You can add a flex-basis with the minimum width you're willing to have and change your flex-shrink property to 0.
.even-content>* {
flex: 1 0 320px;
}
Full code:
.block-content {
width: 100%;
height: 100%;
}
.block-content .even-content {
display: flex;
position: relative;
width: 100%;
margin: 0 auto;
overflow: auto;
white-space: nowrap;
}
.even-content>* {
flex: 1 0 320px;
}
.container {
position: relative;
overflow: hidden;
height: 100%;
width: 100%;
}
.image {
width: 100%;
height: 100%;
transition: all .5s ease;
object-fit: cover;
object-position: center;
}
.card-text {
padding: 3.75rem;
position: absolute;
z-index: 1;
left: 0;
bottom: 0;
}
.card-text h3 {
color: white;
margin-bottom: 2rem;
font-size: 2.25rem;
}
.card-text .fa-arrow-right {
margin-right: 10px;
}
.container:hover .image {
transform: scale(1.03);
}
<section class="block-content">
<div class="even-content scroll-menu">
<div class="container">
<img src="https://cdn.shopify.com/s/files/1/0598/5071/9391/files/homepage_update_september_23_04_900x.png?v=1663942261" alt=" " class="image ">
<div class="card-text ">
<h3>Pack Heavy <br>
<i class="fa-solid fa-arrow-right "></i>Chase Light
</h3>
<button class="button ">Watch Now</button>
</div>
</div>
<div class="container ">
<img src="https://cdn.shopify.com/s/files/1/0598/5071/9391/files/homepage_us_au_mid_august_04_900x.png?v=1660903200
" alt=" " class="image ">
<div class="card-text ">
<h3>Midnight Sun</h3>
<button class="button ">Shop</button>
</div>
</div>
<div class="container ">
<img src="https://cdn.shopify.com/s/files/1/0598/5071/9391/files/homepage_update_september_23_05_ecfb361d-bd54-4d01-b9f1-0669bfd82552_900x.png?v=1663943416
" alt=" " class="image ">
<div class="card-text ">
<h3>SS22</h3>
<button class="button ">Shop</button>
</div>
</div>
</div>
</section>
Return to post

Adding a vertically scrollable item inside a horizontal carousel

I'm building a customised horizontal carousel, where in I want to display some items which are vertically scroll-able.
Code I've tried so far:
html
<div class="carousel">
<div class="c-item">Item-1</div>
<!-- to be displayed vertically -->
<div class="abs">
<div class="a-item">Abs Item-1.1</div>
<div class="a-item">Abs Item-1.2</div>
<div class="a-item">Abs Item-1.3</div>
</div>
<div class="c-item margin">Item-2</div>
<!-- to be displayed vertically -->
<div class="abs">
<div class="a-item">Abs Item-2.1</div>
<div class="a-item">Abs Item-2.2</div>
<div class="a-item">Abs Item-2.3</div>
</div>
</div>
<div class="other">
Other div
</div>
css
.carousel{
color: #FFF;
white-space: nowrap;
overflow-x: auto;
overflow-y: hidden;
position: initial;
.c-item{
display: inline-block;
width: 35%;
background: #000;
height: 100px;
&.margin{
//margin-left: 35%;
}
}
.abs{
background: #444;
display: inline-block;
vertical-align: top;
width: 35%;
max-height: 180px;
overflow-y: auto;
.a-item{
height: 100px;
border: 1px solid #000;
}
}
}
.other{
background: yellow;
}
Result:
(codepen)
The problem here is: I want the other div to start just below the item-1; meaning that the vertically scrolled div should be overlapping the other div and the carousel height should be fixed at 100px. I tried using position: absolute for the .abs div but then that div doesn't move on scrolling the carousel.
Desired output will look like this:
A flexbox solution
Each item is 33.33% wide and 100px high. The items inside .multiple are also 100px high.
.multiple has position: relative and overflow-y: auto. The items inside have position: absolute.
Hint: Container -> position: relative, items inside -> position: absolute. That's how it works.
top: (100 * n)px for each <div> inside .item.multiple. n is the index of the <div> inside .item.multiple, starting with 0.
The HTML structure has been changed
* {
box-sizing: border-box;
}
body {
margin: 0;
}
.carousel {
display: flex;
width: 100vw;
overflow-x: auto;
color: white;
}
.carousel>.item {
flex: 1 0 33.33%;
//margin-right: 5px;
}
.carousel>.item:nth-child(odd) {
background: black;
}
.carousel>.item:nth-child(even) {
background: darkgrey;
}
.carousel>.item,
.carousel>.item.multiple>div {
height: 100px;
}
.carousel>.item.multiple {
position: relative;
overflow-y: auto;
}
.carousel>.item.multiple>div {
position: absolute;
width: 100%;
}
.carousel>.item.multiple>div:nth-child(2) {
top: 100px;
}
.carousel>.item.multiple>div:nth-child(3) {
top: 200px;
}
/* And so on ...
.carousel>.item.multiple>div:nth-child(...) {}
*/
<div class="carousel">
<div class="item">
<div>Item-1</div>
</div>
<div class="item multiple">
<div>Item-1.1</div>
<div>Item-1.2</div>
<div>Item-1.3</div>
</div>
<div class="item">
<div>Item-2</div>
</div>
<div class="item multiple">
<div>Item-2.1</div>
<div>Item-2.2</div>
<div>Item-2.3</div>
</div>
</div>
<div class="other">
Other div
</div>
Your desired result mean making the child overlap the parent, and i don't think that's possible. BUT you can "hack" this by wrapping the .carousel with another div (.demo it this general example), so the results will be something like this:
.demo {overflow: visible; height: 100px;}
.carousel {
color: #FFF;
white-space: nowrap;
overflow-x: auto;
overflow-y: hidden;
position: initial;
}
.carousel .c-item {
display: inline-block;
width: 35%;
background: #000;
height: 100px;
}
.carousel .abs {
background: #444;
display: inline-block;
vertical-align: top;
width: 35%;
max-height: 180px;
overflow-y: auto;
}
.carousel .abs .a-item {
height: 100px;
border: 1px solid #000;
}
.other {
background: yellow;
height: 200px;
}
<div class="demo">
<div class="carousel">
<div class="c-item">Item-1</div>
<div class="abs">
<div class="a-item">Abs Item-1.1</div>
<div class="a-item">Abs Item-1.2</div>
<div class="a-item">Abs Item-1.3</div>
</div>
<div class="c-item margin">Item-2</div>
<div class="abs">
<div class="a-item">Abs Item-2.1</div>
<div class="a-item">Abs Item-2.2</div>
<div class="a-item">Abs Item-2.3</div>
</div>
</div>
</div>
<div class="other">
Other div
</div>
As you can see from the snippet the scroll-x doesn't show - yet it exist. You can click one of the .carousel item and scroll them right and left.
Since it's not obvious that the .carousel is scrolling, you can add extra buttons to scroll it:
.demo {overflow: visible; height: 100px;z-index: 3;}
.carousel {
color: #FFF;
white-space: nowrap;
overflow-x: auto;
overflow-y: hidden;
position: initial;
}
.carousel .c-item {
display: inline-block;
width: 35%;
background: #000;
height: 100px;
}
.carousel .abs {
background: #444;
display: inline-block;
vertical-align: top;
width: 35%;
max-height: 180px;
overflow-y: auto;
}
.carousel .abs .a-item {
height: 100px;
border: 1px solid #000;
}
.other {
background: yellow;
height: 200px;
}
<div class="demo">
<button onclick="document.querySelectorAll('.carousel')[0].scrollLeft += 20;" style="position: fixed; top: 50%; right: 0;">L</button>
<button onclick="document.querySelectorAll('.carousel')[0].scrollLeft -= 20;" style="position: fixed; top: 50%; left: 0;">R</button>
<div class="carousel">
<div class="c-item">Item-1</div>
<div class="abs">
<div class="a-item">Abs Item-1.1</div>
<div class="a-item">Abs Item-1.2</div>
<div class="a-item">Abs Item-1.3</div>
</div>
<div class="c-item margin">Item-2</div>
<div class="abs">
<div class="a-item">Abs Item-2.1</div>
<div class="a-item">Abs Item-2.2</div>
<div class="a-item">Abs Item-2.3</div>
</div>
</div>
</div>
<div class="other">
Other div
</div>
Hope that helps!
You have to play with position check snippet.
* {
box-sizing: border-box;
}
body {
margin: 0;
}
.carousel {
display: flex;
width: 100vw;
overflow-x: auto;
color: white;
}
.carousel>.item {
flex: 1 0 33.33%;
//margin-right: 5px;
}
.carousel>.item:nth-child(odd) {
background: black;
}
.carousel>.item:nth-child(even) {
background: darkgrey;
}
.carousel>.item,
.carousel>.item.multiple>div {
height: 100px;
}
.carousel>.item.multiple {
position: relative;
overflow-y: auto;
height: 200px;
}
.carousel>.item.multiple>div {
position: absolute;
width: 100%;
}
.carousel>.item.multiple>div:nth-child(2) {
top: 100px;
}
.carousel>.item.multiple>div:nth-child(3) {
top: 200px;
}
.other {
position: absolute;
z-index: -1;
top: 100px;
width: 100%;
background: green;
height: 117px;
}
/* And so on ...
.carousel>.item.multiple>div:nth-child(...) {}
*/
<div class="carousel">
<div class="item">
<div>Item-1</div>
</div>
<div class="item multiple">
<div>Item-1.1</div>
<div>Item-1.2</div>
<div>Item-1.3</div>
</div>
<div class="item">
<div>Item-2</div>
</div>
<div class="item multiple">
<div>Item-2.1</div>
<div>Item-2.2</div>
<div>Item-2.3</div>
</div>
</div>
<div class="other">
Other div
</div>

How to align 3 images with width 100%

I will make a carousel and i try to align left 3 elements with width 100% each but it is not working.
Can someone tell me how to align 3,4 elements on left to get out of the screens witdh so that i can change the image with the transform css property ?
it worked when i delete from the top of the page but when i insert it,everything is ruined.
.carousel {
width: 100%;
margin: 0;
background-color: #ccc;
position: relative;
overflow-x: hidden;
}
.carousel--list {
margin: 0;
padding: 0;
}
.carousel--slide {
background: #000;
text-align: center;
color:#fff;
width:100%;
display: inline-block;
overflow: hidden;
height: 400px;
padding: 0;
}
.carousel--track{
width: auto;
-webkit-transition: transform 2s;
transition: transform 2s;
}
.carousel--buttons {
content: "";
clear: both;
display: table;
}
.slide--image {
width: 100%;
}
.red{
background: red;
}
.blue{
background: blue;
}
.yellow{
background: yellow;
}
/* transform .*/
<section class="carousel">
<div class="carousel--track">
<div class="carousel--list">
<div class="carousel--slide red" data-index="0">
<img class="slide--image" src="./images/carousel/slider-bg.png">
</div>
<div class="carousel--slide blue" data-index="1">
<img class="slide--image" src="./images/carousel/slider-bg.png">
</div>
<div class="carousel--slide yellow" data-index="2">
<img class="slide--image" src="./images/carousel/slider-bg.png">
</div>
</div>
</div>
<div class="carousel--buttons">
<button onclick="prevSlide()" class="btn--prev btn">Prev</button>
<button onclick="nextSlide()" class="btn--next btn">Next</button>
</div>
</section>
Thanks in advance !
You could use flexbox or bootstrap. With those you will be able to edit your code as a gride and place elements where you wan't.
Flexbox is a css engine. Maybe what you need !
Example for bootstrap :
And flexbox :
Apply white-space: nowrap to the parent .carousel--list class...It will wrap all the inner inline-block items in a single row.
Note: I have applied transform(-30px) to the .carousel--list to give you a visual
Stack Snippet
.carousel {
width: 100%;
margin: 0;
background-color: #ccc;
position: relative;
overflow-x: hidden;
}
.carousel--list {
margin: 0;
padding: 0;
white-space: nowrap;
transform: translateX(-30px);
}
.carousel--slide {
background: #000;
text-align: center;
color: #fff;
width: 100%;
display: inline-block;
overflow: hidden;
height: 150px;
padding: 0;
}
.carousel--track {
width: auto;
-webkit-transition: transform 2s;
transition: transform 2s;
}
.carousel--buttons {
content: "";
clear: both;
display: table;
}
.slide--image {
width: 100%;
}
.red {
background: red;
}
.blue {
background: blue;
}
.yellow {
background: yellow;
}
/* transform .*/
<section class="carousel">
<div class="carousel--track">
<div class="carousel--list">
<div class="carousel--slide red" data-index="0">
<img class="slide--image" src="http://via.placeholder.com/350x150/f00">
</div>
<div class="carousel--slide blue" data-index="1">
<img class="slide--image" src="http://via.placeholder.com/350x150/00f">
</div>
<div class="carousel--slide yellow" data-index="2">
<img class="slide--image" src="http://via.placeholder.com/350x150/f0f">
</div>
</div>
</div>
<div class="carousel--buttons">
<button onclick="prevSlide()" class="btn--prev btn">Prev</button>
<button onclick="nextSlide()" class="btn--next btn">Next</button>
</div>
</section>

first and third div as column in a .row and second div behind Bootstrap 4 Flexbox

How to achieve displaying this layout with flexbox using Bootstrap 4 (so I can strech the decoration div and menu div on desktops?)
I was using Bootstrap 3 but now I'm using Bootstrap 4 this is what I have this so far:
https://codepen.io/anon/pen/RLMKxZ
<div class="container-fluid"
style="padding: 0; background-color: #001143; color: white;">
<div class="row align-items-start">
<div class="col-xs-12 col-sm-1 evento float-left"></div>
<div id="triangulo_div" class="triangulo_div float-left">
<p class="triangulo_rectangulo">triangulo rectangulo.</p>
</div>
<div class="col-xs-12 col-sm-3 float-left menu"
style="background-color: #06184A;">
<div class="menu_subdiv"></div>
<div class="menu_subdivcont">
<div style="text-align: left; vertical-align: middle;">
<div class="menu_link">
<a class="imghover" href=".php"><img
data-alt-src="../img/contacto2.png" src="../img/contacto.png">
1. Menu</a>
</div>
<div class="menu_link" style="background-color: #4FCCE8">
<a class="imghover" href="#"><img data-alt-src="../img/hotel.png"
src="../img/hotel2.png">2. Menu</a>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-3 float-left menu_siguiente"
style="background-color: #06184A;">
<div style="text-align: left; vertical-align: middle;">
<div class="menu_link">
<a class="imghover" href="seleccionar_detalles.php"><img
data-alt-src="../img/habitaciones2.png"
src="../img/habitaciones.png"> 3. Menu</a>
</div>
<div class="menu_link">
<a class="imghover" href=".php"><img
data-alt-src="../img/resumen2.png" src="../img/resumen.png"> 4.
Menu</a>
</div>
</div>
<div class="menu_siguiente_subdiv"></div>
</div>
<div class="col-sm-3 col-lg-5 float-md-right">
</div>
<div id="contenido"
class="col-xs-24 col-sm-7 float-right contenido bck_div2">
<div id="error">
</div>
<div class="formulario" style="min-height: 20em">
<h1>Content</h1>
</div>
</div>
</div>
</div>
Css:
.rwd-line {
display: none;
}
.evento {
display: block;
min-height: 7em;
background-image: url('img/imagen_horizontal.png');
background-position: center;
background-repeat: no-repeat;
-webkit-background-size: 40%;
background-size: 40%;
clear: both;
z-index: 5;
}
.atencion_cliente {
background-color: #001143;
}
.triangulo_div {
display: none;
}
.menu_link {
width: 100vw;
text-indent: 2.6em;
}
#media screen and (min-width: 576px) {
.rwd-line {
display: inline;
}
.menu_link {
width: 100%;
}
.contenido {
top: 6em;
background-color: rgba(79, 204, 232, .9);
}
.triangulo_div {
display: inline-block;
position: relative;
z-index: 5;
pointer-events: none;
padding: 0;
width: 0;
}
.triangulo_rectangulo {
width: 0;
height: 0;
text-indent: -9999px;
border-top: calc(100vh - 75px) solid white;
border-right: 4.8em solid transparent;
}
.menu_siguiente {
float: left;
}
.menu {
float: left;
padding-right: 0;
}
.menu_subdiv {
height: 6em;
vertical-align: top;
}
.menu_subdivcont {
vertical-align: bottom;
}
.menu_siguiente_subdiv {
height: calc(100vh - 268px);
float: left;
padding-right: 0;
}
.evento {
display: block;
height: calc(100vh - 75px);
background-image: url('img/imagen_vertical.png');
background-position: center;
background-position-y: 5em;
background-repeat: no-repeat;
-webkit-background-size: 60%;
background-size: 60%;
}
.container {
position: relative;
margin-bottom: 0;
padding-bottom: 0;
}
}
#media screen and (max-width: 767px) {
.menu, .menu_siguiente {
padding-left: 0;
}
}
#media screen and (min-width: 1500px) {
.imghover {
padding-left: 4em;
}
}
#media screen and (min-width: 1800px) {
.imghover {
padding-left: 6em;
}
}
.menu, .menu_siguiente a, a:hover {
color: white;
}
body, html {
height: 100% !important;
padding: 0;
margin: 0;
background-color: #001143;
}
input, select {
font-size: .9em !important;
}
.evento {
background-color: white;
}
I've tried other ways, like without flexbox succesfully but I wouldn't be able to stretch the divs
Update: here's the code for what I've also tried but it won't stretch the Decoration and Menu divs if Content div is higher and there's a blank space at the end of the page
I also updated the other example as I forgot to include a first div with Logo
https://codepen.io/anon/pen/jGzdwm

Bootstrap rows overlapping when viewing on smaller screens

So basically the question is in the header. When I lower my screen size, the columns drop below, but start to overlap with the row below.
I am just wanting to know if there is something really obvious that I'm missing.
I just can't seem to find a solution that will work for me.
See screenshot and code below...
#section-headings {
font-size: 44px;
}
h1 {
text-align: center;
color: #ffffff !important;
}
h2 {
text-align: center;
}
#tag-line {
color: #ffffff !important;
}
#main-header {
margin: 0;
}
.jumbotron {
background-image: url(../images/alaska-landscape.jpg);
background-size: cover;
height: 100vh;
width: 100%;
margin: 0;
}
#services {
background-color: #fC99B0;
height: 100vh;
width: 100%;
margin: 0;
}
#services-col {
padding: 80px;
}
#general-text {
text-align: justify;
}
#about {
background-color: #8589FC;
height: 100vh;
width: 100%;
margin: 0;
}
#previous-work {
background-color: #28292D;
height: 100vh;
width: 100%;
margin: 0;
}
.col-md-6, .col-sm-6 {
border-bottom: 0;
margin-bottom: 0;
margin: 0;
}
#glyphicon-image {
display: block;
margin: 0 auto;
}
<!-- Section 2 Services -->
<div id="services" class="container">
<div id="services-row" class="row">
<h1 id="section-headings">services</h1>
<div id="services-col" class="col-md-6 col-sm-6">
<h2>heading 1</h2>
<p id="general-text">paragraph text 1</p>
<img id="glyphicon-image" src="images/bar-chart.png" alt="ux-glyphicon" style="width:128px;height:128px;">
</div>
<div id="services-col" class="col-md-6 col-sm-6">
<h2>heading 2</h2>
<p id="general-text">paragraph text 2</p>
<img id="glyphicon-image" src="images/domain-registration.png" alt="ux-glyphicon" style="width:128px;height:128px;">
</div>
</div>
</div>
<!-- Section 3 About -->
<div id="about" class="container">
<div id="about-row" class="row">
<h1 id="section-headings">about site</h1>
<div class="col-md-6 col-sm-6">
<img src="..." alt="AboutImage">
</div>
<div class="col-sm-6">
<p>Add the about text here and the about image over there <---</p>
</div>
</div>
</div>
WEBPAGE WITH SMALL RESOLUTION
The problem lies in the fact that you set the height to 100vh. As in
#services {
background-color: #fC99B0;
height: 100vh;
width: 100%;
margin: 0;
}
What you should probably do is set the minimum height to 100vh (I'm guessing that you want to have one section take the full height) but leave the height and max-height alone, this way if the height of the content is higher than the screen's, your element will grow bigger to accommodate.
#services {
background-color: #fC99B0;
min-height: 100vh;
width: 100%;
margin: 0;
}
#section-headings {
font-size: 44px;
}
h1 {
text-align: center;
color: #ffffff !important;
}
h2 {
text-align: center;
}
#tag-line {
color: #ffffff !important;
}
#main-header {
margin: 0;
}
.jumbotron {
background-image: url(../images/alaska-landscape.jpg);
background-size: cover;
height: 100vh;
width: 100%;
margin: 0;
}
#services {
background-color: #fC99B0;
min-height: 100vh;
width: 100%;
margin: 0;
}
#services-col {
padding: 80px;
}
#general-text {
text-align: justify;
}
#about {
background-color: #8589FC;
min-height: 100vh;
width: 100%;
margin: 0;
}
#previous-work {
background-color: #28292D;
height: 100vh;
width: 100%;
margin: 0;
}
.col-md-6, .col-sm-6 {
border-bottom: 0;
margin-bottom: 0;
margin: 0;
}
#glyphicon-image {
display: block;
margin: 0 auto;
}
<!-- Section 2 Services -->
<div id="services" class="container">
<div id="services-row" class="row">
<h1 id="section-headings">services</h1>
<div id="services-col" class="col-md-6 col-sm-6">
<h2>UX Design and SEO</h2>
<p id="general-text">My main area of focus and expertise is in helping businesses to create a strong, appropriate online presence that helps them connect and communicate with there customers in the best way possible.</p>
<img id="glyphicon-image" src="images/bar-chart.png" alt="ux-glyphicon" style="width:128px;height:128px;">
</div>
<div id="services-col" class="col-md-6 col-sm-6">
<h2>Website Development</h2>
<p id="general-text">Unlike most UX and SEO consultants, I will not only work with you to design an optimal solution for you and your audience, but I will also implement your solution for you, rather than send you out to fix things on your own.</p>
<img id="glyphicon-image" src="images/domain-registration.png" alt="ux-glyphicon" style="width:128px;height:128px;">
</div>
</div>
</div>
<!-- Section 3 About -->
<div id="about" class="container">
<div id="about-row" class="row">
<h1 id="section-headings">about nomadic</h1>
<div class="col-md-6 col-sm-6">
<img src="..." alt="AboutImage">
</div>
<div class="col-sm-6">
<p>Add the about text here and the about
image over there <---</p>
</div>
</div>
</div>
i thinks it solution
Add a div after each container with class ,
col-sm-12 pad-0
and add this css
.pad-0{padding:0;}
Will solve the problem easily.
See working example below :
/*--CSS--*/
.clrfix{clear:both;}
#section-headings {
font-size: 44px;
}
#section-headings {
display: block;
float: left;
width: 100%;
}
h1 {
text-align: center;
color: #ffffff !important;
}
h2 {
text-align: center;
}
#tag-line {
color: #ffffff !important;
}
#main-header {
margin: 0;
}
.jumbotron {
background-image: url(../images/alaska-landscape.jpg);
background-size: cover;
height: 100vh;
width: 100%;
margin: 0;
}
#services {
background-color: #fC99B0;
height: 100vh;
width: 100%;
margin: 0;
}
#services-col {
padding: 80px;
}
#general-text {
text-align: justify;
}
#about {
background-color: #8589FC;
height: 100vh;
width: 100%;
margin: 0;
}
#previous-work {
background-color: #28292D;
height: 100vh;
width: 100%;
margin: 0;
}
.col-md-6, .col-sm-6 {
border-bottom: 0;
margin-bottom: 0;
margin: 0;
}
#glyphicon-image {
display: block;
margin: 0 auto;
}
#media (max-width: 767px){#services-col { padding:0 10%;}
<!--HTML-->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<!-- Section 2 Services -->
<div id="services" class="container">
<div class="col-sm-12 pad-0">
<div id="services-row" class="row">
<h1 id="section-headings">services</h1>
<div id="services-col" class="col-md-6 col-sm-6">
<h2>UX Design and SEO</h2>
<p id="general-text">My main area of focus and expertise is in helping businesses to create a strong, appropriate online presence that helps them connect and communicate with there customers in the best way possible.</p>
<img id="glyphicon-image" src="images/bar-chart.png" alt="ux-glyphicon" style="width:128px;height:128px;">
</div>
<div id="services-col" class="col-md-6 col-sm-6">
<h2>Website Development</h2>
<p id="general-text">Unlike most UX and SEO consultants, I will not only work with you to design an optimal solution for you and your audience, but I will also implement your solution for you, rather than send you out to fix things on your own.</p>
<img id="glyphicon-image" src="images/domain-registration.png" alt="ux-glyphicon" style="width:128px;height:128px;">
</div>
</div>
</div>
</div>
<div class="clrfix"></div>
<!-- Section 3 About -->
<div id="about" class="container">
<div class="col-sm-12 pad-0">
<h1 id="section-headings">about nomadic</h1>
<div id="about-row" class="row">
<div class="col-md-6 col-sm-6">
<img src="..." alt="AboutImage">
</div>
<div class="col-sm-6">
<p>Add the about text here and the about image over there <---</p>
</div>
</div>
</div>
</div>