Bootstrap rows overlapping - html

I am trying to make a page that has two sections that stack on top of each other using rows. Each section is supposed to be the height of the browser window but for some reason the second row overlaps most of the first except for the header.
Here is a link to my code:
http://www.bootply.com/WwcepyZC01

If I understand your question correctly, you can do this using height: 100vh, and remove the position: absolute. I've also restructured your HTML a bit so that .layer2 is not a child of .layer1.
.layer1 {
width: 100%;
height: 100vh;
background-image: url(<%=asset_path "home_bg.jpg"%>);
background-size: cover;
background-color: purple;
}
.title-wide h1 {
top: 10%;
left: 10%;
right: 10%;
color: #ffffff;
font-size: 10vmax;
}
.home-caption {
position: absolute;
left: 20%;
right: 20%;
top: 30%;
}
.title-wide h2 {
color: #ffffff;
font-size: 4vmax;
}
.col-md-7 {
position: absolute;
text-align: center;
left: 15%;
right: 15%;
height: 100%;
top: 50%;
font-size: 10vw;
}
.btn-default {
background: rgba(255, 255, 255, 0.8);
}
.title-wide {
left: 90%;
right: 90%;
}
.btn-xlarge {
padding: 20px 20px;
font-weight: 700;
line-height: normal;
border-radius: 200px;
border: 2px solid none;
text-align: center center;
height: 3em;
font-size: 25px;
width: 10em;
}
.layer2 {
width: 100%;
height: 100vh;
background-size: cover;
background-color: green;
}
<div class="layer1 row-fluid">
<div class="title-wide text-center">
<h1>My Name</h1>
<div class="home-caption text-center">
<h2>I am a person working for a nameless corporation</h2>
<div class="row">
<hr>
<div class="offset4">
</div>
</div>
</div>
</div>
</div>
<div class="layer2 row-fluid">
</div>
<div id="push"></div>

Related

Absolutely positioned black screen covers the text of a div but not the image and I don't understand why [duplicate]

This question already has answers here:
Position absolute but relative to parent
(5 answers)
Closed 2 years ago.
As you can see in the code below, the absolutely positioned black screen div covers the members's username but not the actual image. The image stays over the black screen as if it has high z-index, but it doesn't. Is there any way to make the black screen cover the image without completely rewriting the CSS?
.members {
width: 239px;
background-color: #2f3136;
}
.member {
display: flex;
align-items: center;
padding: 30px 20px 30px 20px;
}
.member-image-container {
position: relative;
margin-right: 10px;
}
.member-image {
width: 32px;
height: 32px;
border-radius: 50%;
}
.member-username {
font-weight: 500;
color: #8e9297;
margin-right: 10px;
}
.crown {
color: #faa61a;
}
.online-indicator,
.offline-indicator
{
width: 10px;
height: 10px;
border-radius: 50%;
position: absolute;
bottom: 0;
right: 0;
}
.online-indicator {
background-color: #43b581;
}
.offline-indicator {
background-color: #747f8d;
}
.black-screen {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.8);
}
<div class='navigation'>
<div class='modal'>
<div class="black-screen"></div>
</div>
</div>
<div class='server'>
<div class="members">
<div class="member">
<div class="member-image-container">
<img class='member-image' src="https://api.adorable.io/avatars/100/BozhidarKabzamalov">
<div class='online-indicator'></div>
</div>
<span class='member-username'>Username</span>
</div>
</div>
</div>
Just add position: relative; in member-username
Hope it will work.
.members {
width: 239px;
background-color: #2f3136;
}
.member {
display: flex;
align-items: center;
padding: 30px 20px 30px 20px;
}
.member-image-container {
position: inherit;
margin-right: 10px;
}
.member-image {
width: 32px;
height: 32px;
border-radius: 50%;
}
.member-username {
font-weight: 500;
color: #8e9297;
margin-right: 10px;
position: inherit;
}
.crown {
color: #faa61a;
}
.online-indicator,
.offline-indicator
{
width: 10px;
height: 10px;
border-radius: 50%;
position: absolute;
bottom: 0;
right: 0;
}
.online-indicator {
background-color: #43b581;
}
.offline-indicator {
background-color: #747f8d;
}
.black-screen {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.8);
}
<div class='navigation'>
<div class='modal'>
<div class="black-screen"></div>
</div>
</div>
<div class='server'>
<div class="members">
<div class="member">
<div class="member-image-container">
<img class='member-image' src="https://api.adorable.io/avatars/100/BozhidarKabzamalov">
<div class='online-indicator'></div>
</div>
<span class='member-username'>Username</span>
</div>
</div>
</div>

Position: absolute overlapping with wide viewport

I have a slightly rotated div creating an asymetrical graphic on my start page. I use overflow: hidden to hide the overlap from that div. Everything uses absolute positioning to get the elements exactly where I want them and vw and vh to make it responsive. It looks great while the aspect ratio is "normal" but when the window approaches a 2 or 3:1 aspect ratio (like an ultrawide monitor) everything overlaps. Narrow aspect ratio is not a problem since I have it switch to mobile view before it becomes a problem.
I considered using overflow: auto so it wouldn't be forced to fit in the viewport but then it's possible to see the edges of the rotated div.
Is there a solution to this or is this perhaps bad practice and should be done differently?
html, body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
#body {
overflow: hidden;
background: red;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.shape {
position: absolute;
right: -10%;
top: -50%;
height: 200%;
width: 45%;
transform: rotate(350deg);
background: white;
}
#welcome {
position: absolute;
color: black;
z-index: 999;
margin-left: 65vw;
margin-top: 10vh;
}
#welcome h1 {
margin-bottom: 0;
font-size: 7vw;
}
#welcome p {
font-size: 4vw;
margin-top: 0;
}
#startbtn {
position: absolute;
font-size: 3vw;
padding: 4vh 5.5vw 4vh 5.5vw;
background: blue;
color: white;
border: none;
margin-left: 65vw;
margin-top: 70vh;
}
<body id="body">
<div class="shape"></div>
<div class="wrapper">
<div id="welcome" autofocus>
<h1>Welcome</h1>
<p>More Text Here</p>
</div>
</div>
<div class="wrapper">
<input type="button" id="startbtn" onclick="getstarted()" value="Get Started">
</div>
</body>
</html>
Thanks!
Welcome to Stackoverflow.
Putting the shape into the same container (I used the first wrapper) as your content should fix the problem. Why is this: Because the white shape should be in relation to your content. Also I did put the button in the same container.
And you dont need background-sizes for your body as it is just plain red.
I might have messed up your original dimensions, but this should do the trick.
html,
body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
body {
overflow: hidden;
background: red;
}
.wrapper {
position: relative;
height: 100%;
}
.shape {
position: absolute;
margin-top: -50%;
margin-right: -50%;
right: 0;
height: 300%;
width: 100%;
transform: rotate(350deg);
background: white;
}
#welcome {
position: absolute;
color: black;
z-index: 999;
margin-left: 65vw;
margin-top: 10vh;
}
#welcome h1 {
margin-bottom: 0;
font-size: 7vw;
}
#welcome p {
font-size: 4vw;
margin-top: 0;
}
#startbtn {
position: absolute;
font-size: 3vw;
padding: 4vh 5.5vw 4vh 5.5vw;
background: blue;
color: white;
border: none;
margin-left: 65vw;
margin-top: 70vh;
}
html,
body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
#body {
overflow: hidden;
background: red;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.wrapper {
position: relative;
height: 100%;
}
.shape {
position: absolute;
margin-top: -50%;
margin-right: -50%;
right: 0;
height: 300%;
width: 100%;
transform: rotate(350deg);
background: white;
}
#welcome {
position: absolute;
color: black;
z-index: 999;
margin-left: 65vw;
margin-top: 10vh;
}
#welcome h1 {
margin-bottom: 0;
font-size: 7vw;
}
#welcome p {
font-size: 4vw;
margin-top: 0;
}
#startbtn {
position: absolute;
font-size: 3vw;
padding: 4vh 5.5vw 4vh 5.5vw;
background: blue;
color: white;
border: none;
margin-left: 65vw;
margin-top: 70vh;
}
<div class="wrapper">
<div class="shape"></div>
<div id="welcome" autofocus>
<h1>Welcome</h1>
<p>More Text Here</p>
</div>
<input type="button" id="startbtn" onclick="getstarted()" value="Get Started">
</div>

z-index positioning of pseudo element

I can't seem to figure out how to get the line positioned underneath the circles. Z-index isn't working and I've got the divs positioned non-static. How can I accomplish this? The idea would be that the portion of the line that overlaps the circles would be positioned behind the circles.
div.step-line {
margin: 0;
}
div.step-col {
padding: 30px 0;
text-align: center;
}
div.step-line div.step-title:before {
right: 50%;
}
div.step-line div.step-number {
font-size: 26px;
border-radius: 50%!important;
display: inline-block;
margin: auto;
padding: 9px;
border: 3px solid #e5e5e5;
position: relative;
z-index: 5;
height: 60px;
width: 60px;
/*text-align: center;*/
}
div.step-line div.step-title {
position:relative;
font-size: 20px;
font-weight: 400;
text-transform: uppercase;
}
div.step-line div.step-title:after {
content: '';
height: 3px;
width: 100%;
position: absolute;
background-color: #e5e5e5;
z-index: 4;
transform: translateY(-100%);
top: -90%;
left: 0%;
}
div.step-line div.step-col.first div.step-title:after {
width: 50%;
left: 50%;
}
div.step-line div.step-col.last div.step-title:after {
width: 50%;
right: 50%;
}
<div class="row step-line">
<div class="col-md-4 step-col first">
<div class="step-number">1</div>
<div class="step-title">This is a step title</div>
<div class="step-content">This is a description</div>
</div>
<div class="col-md-4 step-col">
<div class="step-number">2</div>
<div class="step-title">This is a step title</div>
<div class="step-content">This is a description</div>
</div>
<div class="col-md-4 step-col last">
<div class="step-number">3</div>
<div class="step-title">This is a step title</div>
<div class="step-content">This is a description</div>
</div>
</div>
What i understand from your question is, you want your lines to be behind those circles, just add background color background-color: white; in your CSS
Final code:
div.step-line div.step-number {
font-size: 26px;
border-radius: 50%!important;
display: inline-block;
margin: auto;
padding: 9px;
border: 3px solid #e5e5e5;
position: relative;
z-index: 5;
height: 60px;
width: 60px;
/*text-align: center;*/
background-color: white;
}

How to align a picture to the bottom of another picture?

How to align the raccoon picture so it appear at the right bottom of the big round picture? As it is at the image.
I tried background-position: bottom right; as well as position: absolute; but it doesn't work.
See the code below.
Thank You.
.p-i--1 {
background-image: url(http://www.zerohedge.com/sites/default/files/pictures/picture-3930.jpg);
}
.p-i {
border-radius: 50%;
background-position: bottom right;
width: 40px;
height: 40px;
position: absolute;
}
.p-1 {
float: left;
width: 220px;
height: 100%;
position: relative;
}
.p-wrap {
bottom: 0;
width: 100%;
text-align: center;
}
.pic-wrap {
width: 122px;
height: 122px;
margin: 0 auto;
}
.p_pic-1 {
background-image: url(http://www.fernomortuary.com/~/media/products-mortuary/swatches/Swatch_Burgundy.ashx?w=122);
background-position: center;
float: left;
width: 122px;
height: 122px;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
}
.p-description {
font-family: Roboto;
font-weight: 300;
color: #666;
font-size: 14px;
text-align: center;
float: left;
margin-top: 0;
}
.p-name {
text-align: center;
}
<div class="p-1">
<div class="p-i--1 p-i"></div>
<div class="pic-wrap">
<a class="p_pic-1" href="index.html"></a>
</div>
<div class="p_wrap">
<h4 class="p-name">Some text</h4>
<p class="p-description">Some very very very very long description</p>
</div>
</div>
Put the smaller picture within .pic-wrap. Give it an absolute position and align it using bottom and right properties:
JS Fiddle
CSS Changes made:
.pic-wrap {
position: relative;
}
.p-i {
position: absolute;
bottom: 0;
right: 0;
}
And if you want the white border around the small image:
.p-i {
border: 3px solid white;
}
JS Fiddle
Just add a bottom and right property to your absolute element like this:
.p-i {
border-radius: 50%;
background-position: bottom right;
width: 40px;
height: 40px;
position: absolute;
bottom: 100px;
right: 50px;
}
Here's a snippet with the above codes:
.p-i--1 {
background-image: url(http://www.zerohedge.com/sites/default/files/pictures/picture-3930.jpg);
}
.p-i {
border-radius: 50%;
background-position: bottom right;
width: 40px;
height: 40px;
position: absolute;
bottom: 100px;
right: 50px;
}
.p-1 {
float: left;
width: 220px;
height: 100%;
position: relative;
}
.p-wrap {
bottom: 0;
width: 100%;
text-align: center;
}
.pic-wrap {
width: 122px;
height: 122px;
margin: 0 auto;
}
.p_pic-1 {
background-image: url(http://www.fernomortuary.com/~/media/products-mortuary/swatches/Swatch_Burgundy.ashx?w=122);
background-position: center;
float: left;
width: 122px;
height: 122px;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
}
.p-description {
font-family: Roboto;
font-weight: 300;
color: #666;
font-size: 14px;
text-align: center;
float: left;
margin-top: 0;
}
.p-name {
text-align: center;
}
<div class="p-1">
<div class="p-i--1 p-i"></div>
<div class="pic-wrap">
<a class="p_pic-1" href="index.html"></a>
</div>
<div class="p_wrap">
<h4 class="p-name">Some text</h4>
<p class="p-description">Some very very very very long description</p>
</div>
</div>
Here is a fiddle: https://jsfiddle.net/6sxLj3hL/
Your hard coded height on the container wasn't necessary so I removed it.
.p-i--1 {
background-image: url(http://www.zerohedge.com/sites/default/files/pictures/picture-3930.jpg);
}
.p-i {
border-radius: 50%;
background-position: bottom right;
width: 40px;
height: 40px;
float:right
}
.p-1 {
float: left;
width: 220px;
height: 100%;
position: relative;
}
.p-wrap {
bottom: 0;
width: 100%;
text-align: center;
}
.pic-wrap {
width: 122px;
margin: 0 auto;
overflow: auto;
}
.p_pic-1 {
background-image: url(http://www.fernomortuary.com/~/media/products-mortuary/swatches/Swatch_Burgundy.ashx?w=122);
background-position: center;
width: 122px;
height: 122px;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
display: block;
overflow: auto;
}
.p-description {
font-family: Roboto;
font-weight: 300;
color: #666;
font-size: 14px;
text-align: center;
float: left;
margin-top: 0;
}
.p-name {
text-align: center;
}
I rearranged your HTML a bit
<div class="p-1">
<div class="pic-wrap">
<a class="p_pic-1" href="index.html"></a>
<div class="p-i--1 p-i"></div>
</div>
<div class="p_wrap">
<h4 class="p-name">Some text</h4>
<p class="p-description">
Some very very very very long description
</p>
</div>
</div>

HTML Div Wont Scroll

Currently I am making a website. I input images into a div, and then text overlays that image to describe it. I put the text over the image, and then put a opacity of .5. The problem with my code is that the text will not scroll. The scroll is shown, but it will not work.
My HTML
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="style.css"/>
<style type="text/css">
<!--
body {
margin: 0px;
}
-->
</style>
</head>
<body>
<div id="wrapper">
<div id="background">
<h10>.</h10>
</div>
<div id="header">
<div id="logobackground">
<img src="http://localhost/cabinchic/logo.png">
</div>
<div id="navbar">
<a href="http://localhost/cabinchic/home.html">
<div id="homebutton">
<h1> Home </h1>
</div>
</a>
<a href="http://localhost/cabinchic/homedecor.html">
<div id="homedecorbutton" style="border-radius: 8px; color: #00693E;;background-image: url(http://localhost/cabinchic/woodplankgreen.jpg)">
<h1> Home Decor </h1>
</div>
</a>
<a href="http://localhost/cabinchic/askheather.html">
<div id="askheatherbutton">
<h1> Ask Heather </h1>
</div>
</a>
</div>
</div>
<div id="leftbox">
</div>
<div id="mainbox">
<div class="picture" style="background-image: url(http://localhost/cabinchic/stones.jpg)">
<div class="text">
<h1> 26473264738654356427564 gyugfyubyeefwafwaf67erafh6ea7f67webf7bqyeuiewHFUIWhf78whiuNEuiwehui </h1>
</div>
</div>
</div>
<div id="footer">
<div id="footerborder">
<h10>.</h10>
</div>
<center>
<img src="http://localhost/cabinchic/logo.png" style="max-height: 18%; margin-top: -2%">
<div id="footertextcr"> <h1>All Rights Reserved &copy 2014 Python Daily</h1> </div>
<div id="footertext"> <h1>Logo made by Fatpaint | Site made by Michael Jones</h1> </div>
</center>
</div>
</div>
</body>
</html>
My CSS
/*Dartmouth Green Color Code Is #00693E*/
#background {
background-image: url("http://localhost/cabinchic/flatstone.jpg");
z-index: -10;
height: 160%;
width: 100%;
position: absolute;
}
#wrapper {
height: 100%;
width: 100%;
/*overflow-y: scroll;*/
position: absolute;
}
#header {
height: 100%;
width: 100%;
position: fixed;
}
#logobackground {
width: 100%;
background-image: url("http://localhost/cabinchic/wood.jpg");
text-align: center;
position: fixed;
margin-top: -3.8%;
}
#navbar {
height: 10%;
width: 100%;
background-image: url("http://localhost/cabinchic/woodbark.jpg");
margin-top: 13.6%;
position: fixed;
border-top: 1px solid black;
border-bottom: 1px solid black;
}
#homebutton {
background-image: url("http://localhost/cabinchic/woodplank.jpg");
height: 10%;
width: 12%;
position: fixed;
margin-left: 19%;
text-align: center;
font-size: 80%;
color: black;
}
#homebutton:hover {
color: #00693E;
border-radius: 8px;
}
#homedecorbutton {
background-image: url("http://localhost/cabinchic/woodplank.jpg");
height: 10%;
width: 12%;
position: fixed;
margin-left: 44%;
text-align: center;
font-size: 80%;
color: black;
}
#homedecorbutton:hover {
color: #00693E;
border-radius: 8px;
}
#askheatherbutton {
background-image: url("http://localhost/cabinchic/woodplank.jpg");
height: 10%;
width: 12%;
position: fixed;
margin-left: 69%;
text-align: center;
font-size: 80%;
color: black;
}
#askheatherbutton:hover {
color: #00693E;
border-radius: 8px;
}
#leftbox {
width: 20%;
height: 105.8%;
position: absolute;
background-image: url("http://localhost/cabinchic/barkpine.jpg");
margin-top: 19%;
border-right: 1px solid black;
border-bottom: 1px solid black;
border-top: 1px solid black;
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
z-index: -1;
background-size: 100%;
}
#mainbox {
width: 76%;
height: 100%;
position: absolute;
margin-top: 20.4%;
margin-left: 22%;
background-image: url("http://localhost/cabinchic/barkbrown.jpg");
border-radius: 8px;
border: 1px solid black;
/*background-size: 100%;*/
z-index: -1;
}
.picture {
border-radius: 6px;
border: 1px solid black;
background-size: cover;
position: absolute;
height: 55%;
width: 80%;
margin-left: 10%;
border-bottom-right-radius: 0px;
max-height: 55%;
z-index: 1;
}
.text {
overflow-y: scroll;
width: 100%;
height: 20%;
max-height: 20%;
background-color: black;
color: white;
opacity: .5;
border-top: 2px solid white;
margin-top: 34.3%;
font-size: 60%;
z-index: 2;
position: relative;
}
#footer {
width: 100%;
margin-top: 70%;
background-image: url("http://localhost/cabinchic/wood.jpg");
border-bottom: 1px solid black;
}
#footerborder {
width: 100%;
height: 2%;
margin-top: 40%;
background-image: url("http://localhost/cabinchic/woodbark.jpg");
}
#footertextcr {
color: white;
font-size: 50%;
margin-top: -3.5%;
}
#footertext {
color: white;
font-size: 40%;
margin-top: -1%;
}
a, u {
text-decoration: none;
}
Sorry that there is no spacing in the CSS code it didn't paste right...
Problem #1:
Your header has a height of 100%, a width of 100%, and is fixed over the page, thus covering the div and scroll bars and removing the ability to scroll.
Problem #2:
The container for the text, #mainbox has a z-index of -1, thus putting it and its children behind of everything else:
#mainbox {
width: 76%;
height: 100%;
position: absolute;
margin-top: 20.4%;
margin-left: 22%;
background-image: url("http://localhost/cabinchic/barkbrown.jpg");
border-radius: 8px;
border: 1px solid black;
/*background-size: 100%;*/
}
JSFiddle Demo