Problem: I have to arrange these LI in a very specific way. Here is the image:
but I can't seem to break the boxes up. I have tried Flexbox, ClearFix, etc... no luck.
Please look at the picture so you can see how I am suppose to make this look.
* {
box-sizing: border-box;
}
a {
color: #777777;
}
html, body {
height: 100%;
}
#wrap {
margin: 0 auto;
text-align: center;
width: 960px;
}
.contentBox {
margin: 0 auto;
width: 960px;
height: 80%;
background-color: #ffffff;
border: #dddddd;
border-style: solid;
border-width: .01em;
}
#firstName {
color: white;
margin: 0 auto;
background-color: #4aaaa5;
width: 300px;
height: 85px;
float: left;
font-family: Georgia, 'Times New Roman', Times, serif;
line-height: 250%;
text-align: center;
}
#menu {
color: #777777;
background-color: #ffffff;
width: 300px;
height: 85px;
font-family: Georgia, 'Times New Roman', Times, serif;
float: right;
display: flex;
justify-content: space-between;
align-items: center;
}
hr {
clear: both;
border-width: .03em;
border-bottom-style: solid;
margin: 0 auto;
width: 100%;
align-self: center;
border-color: #777777;
}
#backgroundTest {
background-image: url(https://grobconnolly.github.io/myportfolio/assets/images/swirl_pattern.png);
background-repeat: repeat;
padding: 70px;
height: calc(100% - 87px);
}
#portfolioWrap {
margin: 0 auto;
width: 960px;
background-color: #ffffff;
border: #dddddd;
border-style: solid;
border-width: .01em;
}
.contentHeading {
clear: both;
color: #4aaaa5;
margin: 15px 0 15px 15px;
}
.grayLine {
margin: 15px auto;
color: #777777;
width: 930px;
border-width: 1px;
align-self: center;
}
#footerBox {
margin-top: 50px;
width: 100%;
background-color: #666666;
height: 4rem;
border-top-style: solid;
border-top-color: #4aaaa5;
border-top-width: 10px;
align-self: center;
bottom: 0;
position: fixed;
bottom: 0;
left: 0;
right: 0;
}
#copyright {
text-align: center;
color: white;
overflow: hidden;
}
body {
margin: 0 auto;
}
#robImage {
width: 200px;
height: 200px;
float: left;
margin: 0px 15px 0px 15px;
}
p {
color: #777777;
text-align: left;
margin-left: 15px;
margin-right: 15px;
word-spacing: 3px;
font-family: Arial, Helvetica, sans-serif;
line-height: 1.5;
}
#footerLine {
color: #4aaaa5;
}
#cr1 {
color: white;
text-align: center;
font-family: Arial, Helvetica, sans-serif;
}
/* contact us page CSS */
#contentPadding {
background-image: url("https://lh3.googleusercontent.com/MtzMSUjbfaDQY8xgppp8r826LVuwgwCkTE9aMTfPdHC5OUWr5UcBB4ulo1O_mzdaC6MAkzeN9G_11dSYYZCNfUM1lZKQW9xOfO3gDmeGi9ZW8FysGaSUoRqUctnzDBxjPUu2CF7GbOVdn8WOQviSnopCBSrqraAm0CFro5iQSvor-a513LA2Q4eCi88oB5PIZmJxn_av7T0kHVngc5BNKykQJNR13g4kep_BcaN_YbTrqAZBYfMy2FdD0klkUoQbLshgItmWQ6gH-Q-Ef3gjC0kLbxJBF4nTJJAJ027dahF-Cv_scyWwDDSxS4nNqQ4vsdFahevNFQItM94j8938kSyzw-99t3Ss6K7jo4YmV8Q8ixY5CCuL7-syMcbz6bJ3AMOOth2qjon9IQqr0fao4jqLQaMLK0I2bE8PcTHNISWz95VFiWOYnCxo76YOoClTl4zCO8obfxbo9TKdClhyjxYZ6BmSosFxGhd59YPcmdFmRIO18Vei4PBUyKK8pTPLwixUuG9AEkpljz-A7URK5AZxbUT_VlWBdqZWPbf8kaiiX24eY10BP15A-57I1AeVEuNlV61OsC2xr43YSf3M8-xYb2k1wqsWIE0mocY-L8h_jb8RCISwHmSlwNWGEiVGMvFHpsktw0szLV0UzRydDma0S9tisXJfiQPRzWxFc4aRfyJ2PQmg=s400-no");
background-repeat: repeat;
padding: 70px;
height: 100%;
}
/* Style inputs with type="text", select elements and textareas */
input[type=text],
select,
textarea {
width: 100%;
/* Full width */
padding: 12px;
/* Some padding */
border: 1px solid #cccccc;
/* Gray border */
border-radius: 4px;
/* Rounded borders */
box-sizing: border-box;
/* Make sure that padding and width stays in place */
margin-top: 6px;
/* Add a top margin */
margin-bottom: 16px;
/* Bottom margin */
resize: vertical
/* Allow the user to vertically resize the textarea (not horizontally) */
}
/* Style the submit button with a specific background color etc */
input[type=submit] {
background-color: #4aaaa5;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-family: Arial, Helvetica, sans-serif;
}
/* When moving the mouse over the submit button, add a darker green color */
input[type=submit]:hover {
background-color: #4aaaa5;
font-family: Arial, Helvetica, sans-serif;
}
/* Add a background color and some padding around the form */
.container {
border-radius: 5px;
border-color: #cccccc;
background-color: #ffffff;
padding: 20px;
align-self: center;
font-family: Arial, Helvetica, sans-serif;
color: #777777;
}
/* start of portfolio css */
/*
#boxClass {
display: flex;
width: 540px;
height: 800px;
align-items: flex-start;
justify-content: space-between;
text-align: center; */
#boxTitleHangman {
list-style: none;
height: 150px;
width: 200px;
margin: 10px 15px 30px 15px;
background-size: 100%;
float: left;
background-image: url(https://grobconnolly.github.io/myportfolio/assets/images/hangman.jpg);
}
#hangmanText {
background: #4aaaa5;
width: 200px;
height: 40px;
color: white;
text-align: center;
align-items: center;
position: relative;
top: 80px;
right: 15px;
line-height: 40px;
}
#boxTitleTrivia {
list-style: none;
height: 150px;
width: 200px;
margin: 10px 15px 30px 15px;
background-size: 100%;
float: left;
background-image: url(https://grobconnolly.github.io/myportfolio/assets/images/trivia.jpg);
}
#triviaText {
background: #4aaaa5;
width: 200px;
height: 40px;
color: white;
text-align: center;
align-items: center;
position: relative;
top: 80px;
right: 15px;
line-height: 40px;
}
#boxTitleRock {
list-style: none;
height: 150px;
width: 200px;
margin: 10px 15px 30px 15px;
background-size: 100%;
float: left;
background-image: url(https://grobconnolly.github.io/myportfolio/assets/images/rps.jpg);
}
#rockText {
background: #4aaaa5;
width: 200px;
height: 40px;
color: white;
text-align: center;
align-items: center;
position: relative;
top: 80px;
right: 15px;
line-height: 40px;
}
#boxTitleRpg {
list-style: none;
height: 150px;
width: 200px;
margin: 10px 15px 30px 15px;
background-size: 100%;
float: left;
background-image: url(https://grobconnolly.github.io/myportfolio/assets/images/rpg.jpg);
}
#rpgText {
background: #4aaaa5;
width: 200px;
height: 40px;
color: white;
text-align: center;
align-items: center;
position: relative;
top: 80px;
right: 15px;
line-height: 40px;
}
#boxTitleRutgers {
list-style: none;
height: 150px;
width: 200px;
margin: 10px 15px 30px 15px;
background-size: 100%;
float: left;
background-image: url(https://grobconnolly.github.io/myportfolio/assets/images/rutgers.jpg);
}
#rutgersText {
background: #4aaaa5;
width: 200px;
height: 40px;
color: white;
text-align: center;
align-items: center;
position: relative;
top: 80px;
right: 15px;
line-height: 40px;
}
.portfolioTitle {
background: #4aaaa5;
width: 200px;
height: 40px;
color: white;
text-align: center;
align-items: center;
position: relative;
top: 100px;
right: 15px;
line-height: 40px;
}
#hangmanBackground {
height: 150px;
width: 200px;
margin: 10px 15px 30px 15px;
background-size: 100%;
float: left;
}
#triviaBackground {
height: 150px;
width: 200px;
margin: 10px 15px 30px 15px;
background-size: 100%;
float: left;
}
#rockBackground {
height: 150px;
width: 200px;
margin: 10px 15px 30px 15px;
background-size: 100%;
float: left;
}
#rpgBackground {
height: 150px;
width: 200px;
margin: 10px 15px 30px 15px;
background-size: 100%;
float: left;
}
#rutgersBackground {
height: 150px;
width: 200px;
margin: 10px 15px 30px 15px;
background-size: 100%;
float: left;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Rob Connolly's Portfolio</title>
<link rel="stylesheet" href="./assets/css/style.css">
</head>
<body>
<!-- this div contains the header-->
<div id="wrap">
<header>
<!-- name in header-->
<h1 id="firstName">
Rob Connolly
</h1>
</header>
<!-- Header-->
<div id="menu">
<span>
About
</span>
<span>
Portfolio
</span>
<span>
Contact
</span>
</div>
</div>
<!-- clear fix cleard float-->
<hr id="clearfix">
<!-- background image-->
<div id="backgroundTest">
<!-- Wrap2 wraps portfolio content section-->
<div class="contentBox">
<!-- Portfolio Heading-->
<h2 class="contentHeading">
Portfolio
</h2>
<!-- gray line in about me section-->
<hr class="grayLine">
<!-- Portfolio Form-->
<ul id="boxList">
<li id="boxTitleHangman">
<p id="hangmanText">
Hangman
</p>
</li>
<li id="boxTitleTrivia">
<p id="triviaText">
Trivia
</p>
</li>
<li id="boxTitleRock">
<p id="rockText">
Rock
</p>
</li>
<li id="boxTitleRpg">
<p id="rpgText">
Rpg
</p>
</li>
<li id="boxTitleRutgers">
<p id="rutgersText">
Rutgers
</p>
</li>
</ul>
<!--
<div id="hangman">
<div id="hangmanBackground" style="background-image: url('assets/images/hangman.jpg');">
<p class="portfolioTitle">Hangman</p>
</div>
<div id="trivia">
<div id="triviaBackground" style="background-image: url('assets/images/trivia.jpg');">
<p class="portfolioTitle">Trivia Game</p>
</div>
<div id="rock">
<div id="rockBackground" style="background-image: url('assets/images/rps.jpg');">
<p class="portfolioTitle">Rock Paper Scissors</p>
</div>
</div>
<div id="row2">
<div id="rpg">
<div id="rpgBackground" style="background-image: url('assets/images/rpg.jpg');">
<p class="portfolioTitle">RPG Game</p>
</div>
<div id="rutgers">
<div id="rutgersBackground" style="background-image: url('assets/images/rutgers.jpg');">
<p class="portfolioTitle">Rutgers Info Widget</p>
</div>
</div>
</div>
</div>
</div>
</div> -->
<!-- Start of footer-->
<div id="footerBox">
<!-- Text for footer-->
<p id="cr1"> © Copyright</p>
</div>
</div>
</div>
</div>
</body>
</html>
Welcome to SO, Its simple use column-count: property on ul
Here is updated snippet.
* {
box-sizing: border-box;
}
a {
color: #777777;
}
html, body {
height: 100%;
}
#wrap {
margin: 0 auto;
text-align: center;
width: 960px;
}
.contentBox {
margin: 0 auto;
width: 960px;
height: 100vh;
background-color: #ffffff;
border: #dddddd;
border-style: solid;
border-width: .01em;
}
#firstName {
color: white;
margin: 0 auto;
background-color: #4aaaa5;
width: 300px;
height: 85px;
float: left;
font-family: Georgia, 'Times New Roman', Times, serif;
line-height: 250%;
text-align: center;
}
#menu {
color: #777777;
background-color: #ffffff;
width: 300px;
height: 85px;
font-family: Georgia, 'Times New Roman', Times, serif;
float: right;
display: flex;
justify-content: space-between;
align-items: center;
}
hr {
clear: both;
border-width: .03em;
border-bottom-style: solid;
margin: 0 auto;
width: 100%;
align-self: center;
border-color: #777777;
}
#backgroundTest {
background-image: url(https://grobconnolly.github.io/myportfolio/assets/images/swirl_pattern.png);
background-repeat: repeat;
padding: 70px;
height: 100vh;
}
#portfolioWrap {
margin: 0 auto;
width: 960px;
background-color: #ffffff;
border: #dddddd;
border-style: solid;
border-width: .01em;
}
.contentHeading {
clear: both;
color: #4aaaa5;
margin: 15px 0 15px 15px;
}
#boxList{
column-count: 2;
}
.grayLine {
margin: 15px auto;
color: #777777;
width: 930px;
border-width: 1px;
align-self: center;
}
#footerBox {
margin-top: 50px;
width: 100%;
background-color: #666666;
height: 4rem;
border-top-style: solid;
border-top-color: #4aaaa5;
border-top-width: 10px;
align-self: center;
bottom: 0;
position: fixed;
bottom: 0;
left: 0;
right: 0;
}
#copyright {
text-align: center;
color: white;
overflow: hidden;
}
body {
margin: 0 auto;
}
#robImage {
width: 200px;
height: 200px;
float: left;
margin: 0px 15px 0px 15px;
}
p {
color: #777777;
text-align: left;
margin-left: 15px;
margin-right: 15px;
word-spacing: 3px;
font-family: Arial, Helvetica, sans-serif;
line-height: 1.5;
}
#footerLine {
color: #4aaaa5;
}
#cr1 {
color: white;
text-align: center;
font-family: Arial, Helvetica, sans-serif;
}
/* contact us page CSS */
#contentPadding {
background-image: url("https://lh3.googleusercontent.com/MtzMSUjbfaDQY8xgppp8r826LVuwgwCkTE9aMTfPdHC5OUWr5UcBB4ulo1O_mzdaC6MAkzeN9G_11dSYYZCNfUM1lZKQW9xOfO3gDmeGi9ZW8FysGaSUoRqUctnzDBxjPUu2CF7GbOVdn8WOQviSnopCBSrqraAm0CFro5iQSvor-a513LA2Q4eCi88oB5PIZmJxn_av7T0kHVngc5BNKykQJNR13g4kep_BcaN_YbTrqAZBYfMy2FdD0klkUoQbLshgItmWQ6gH-Q-Ef3gjC0kLbxJBF4nTJJAJ027dahF-Cv_scyWwDDSxS4nNqQ4vsdFahevNFQItM94j8938kSyzw-99t3Ss6K7jo4YmV8Q8ixY5CCuL7-syMcbz6bJ3AMOOth2qjon9IQqr0fao4jqLQaMLK0I2bE8PcTHNISWz95VFiWOYnCxo76YOoClTl4zCO8obfxbo9TKdClhyjxYZ6BmSosFxGhd59YPcmdFmRIO18Vei4PBUyKK8pTPLwixUuG9AEkpljz-A7URK5AZxbUT_VlWBdqZWPbf8kaiiX24eY10BP15A-57I1AeVEuNlV61OsC2xr43YSf3M8-xYb2k1wqsWIE0mocY-L8h_jb8RCISwHmSlwNWGEiVGMvFHpsktw0szLV0UzRydDma0S9tisXJfiQPRzWxFc4aRfyJ2PQmg=s400-no");
background-repeat: repeat;
padding: 70px;
height: 100%;
}
/* Style inputs with type="text", select elements and textareas */
input[type=text],
select,
textarea {
width: 100%;
/* Full width */
padding: 12px;
/* Some padding */
border: 1px solid #cccccc;
/* Gray border */
border-radius: 4px;
/* Rounded borders */
box-sizing: border-box;
/* Make sure that padding and width stays in place */
margin-top: 6px;
/* Add a top margin */
margin-bottom: 16px;
/* Bottom margin */
resize: vertical
/* Allow the user to vertically resize the textarea (not horizontally) */
}
/* Style the submit button with a specific background color etc */
input[type=submit] {
background-color: #4aaaa5;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-family: Arial, Helvetica, sans-serif;
}
/* When moving the mouse over the submit button, add a darker green color */
input[type=submit]:hover {
background-color: #4aaaa5;
font-family: Arial, Helvetica, sans-serif;
}
/* Add a background color and some padding around the form */
.container {
border-radius: 5px;
border-color: #cccccc;
background-color: #ffffff;
padding: 20px;
align-self: center;
font-family: Arial, Helvetica, sans-serif;
color: #777777;
}
/* start of portfolio css */
/*
#boxClass {
display: flex;
width: 540px;
height: 800px;
align-items: flex-start;
justify-content: space-between;
text-align: center; */
#boxTitleHangman {
list-style: none;
height: 150px;
width: 200px;
margin: 10px 15px 30px 15px;
background-size: 100%;
float: left;
background-image: url(https://grobconnolly.github.io/myportfolio/assets/images/hangman.jpg);
}
#hangmanText {
background: #4aaaa5;
width: 200px;
height: 40px;
color: white;
text-align: center;
align-items: center;
position: relative;
top: 80px;
right: 15px;
line-height: 40px;
}
#boxTitleTrivia {
list-style: none;
height: 150px;
width: 200px;
margin: 10px 15px 30px 15px;
background-size: 100%;
float: left;
background-image: url(https://grobconnolly.github.io/myportfolio/assets/images/trivia.jpg);
}
#triviaText {
background: #4aaaa5;
width: 200px;
height: 40px;
color: white;
text-align: center;
align-items: center;
position: relative;
top: 80px;
right: 15px;
line-height: 40px;
}
#boxTitleRock {
list-style: none;
height: 150px;
width: 200px;
margin: 10px 15px 30px 15px;
background-size: 100%;
float: left;
background-image: url(https://grobconnolly.github.io/myportfolio/assets/images/rps.jpg);
}
#rockText {
background: #4aaaa5;
width: 200px;
height: 40px;
color: white;
text-align: center;
align-items: center;
position: relative;
top: 80px;
right: 15px;
line-height: 40px;
}
#boxTitleRpg {
list-style: none;
height: 150px;
width: 200px;
margin: 10px 15px 30px 15px;
background-size: 100%;
float: left;
background-image: url(https://grobconnolly.github.io/myportfolio/assets/images/rpg.jpg);
}
#rpgText {
background: #4aaaa5;
width: 200px;
height: 40px;
color: white;
text-align: center;
align-items: center;
position: relative;
top: 80px;
right: 15px;
line-height: 40px;
}
#boxTitleRutgers {
list-style: none;
height: 150px;
width: 200px;
margin: 10px 15px 30px 15px;
background-size: 100%;
float: left;
background-image: url(https://grobconnolly.github.io/myportfolio/assets/images/rutgers.jpg);
}
#rutgersText {
background: #4aaaa5;
width: 200px;
height: 40px;
color: white;
text-align: center;
align-items: center;
position: relative;
top: 80px;
right: 15px;
line-height: 40px;
}
.portfolioTitle {
background: #4aaaa5;
width: 200px;
height: 40px;
color: white;
text-align: center;
align-items: center;
position: relative;
top: 100px;
right: 15px;
line-height: 40px;
}
#hangmanBackground {
height: 150px;
width: 200px;
margin: 10px 15px 30px 15px;
background-size: 100%;
float: left;
}
#triviaBackground {
height: 150px;
width: 200px;
margin: 10px 15px 30px 15px;
background-size: 100%;
float: left;
}
#rockBackground {
height: 150px;
width: 200px;
margin: 10px 15px 30px 15px;
background-size: 100%;
float: left;
}
#rpgBackground {
height: 150px;
width: 200px;
margin: 10px 15px 30px 15px;
background-size: 100%;
float: left;
}
#rutgersBackground {
height: 150px;
width: 200px;
margin: 10px 15px 30px 15px;
background-size: 100%;
float: left;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Rob Connolly's Portfolio</title>
<link rel="stylesheet" href="./assets/css/style.css">
</head>
<body>
<!-- this div contains the header-->
<div id="wrap">
<header>
<!-- name in header-->
<h1 id="firstName">
Rob Connolly
</h1>
</header>
<!-- Header-->
<div id="menu">
<span>
About
</span>
<span>
Portfolio
</span>
<span>
Contact
</span>
</div>
</div>
<!-- clear fix cleard float-->
<hr id="clearfix">
<!-- background image-->
<div id="backgroundTest">
<!-- Wrap2 wraps portfolio content section-->
<div class="contentBox">
<!-- Portfolio Heading-->
<h2 class="contentHeading">
Portfolio
</h2>
<!-- gray line in about me section-->
<hr class="grayLine">
<!-- Portfolio Form-->
<ul id="boxList">
<li id="boxTitleHangman">
<p id="hangmanText">
Hangman
</p>
</li>
<li id="boxTitleTrivia">
<p id="triviaText">
Trivia
</p>
</li>
<li id="boxTitleRock">
<p id="rockText">
Rock
</p>
</li>
<li id="boxTitleRpg">
<p id="rpgText">
Rpg
</p>
</li>
<li id="boxTitleRutgers">
<p id="rutgersText">
Rutgers
</p>
</li>
</ul>
<!--
<div id="hangman">
<div id="hangmanBackground" style="background-image: url('assets/images/hangman.jpg');">
<p class="portfolioTitle">Hangman</p>
</div>
<div id="trivia">
<div id="triviaBackground" style="background-image: url('assets/images/trivia.jpg');">
<p class="portfolioTitle">Trivia Game</p>
</div>
<div id="rock">
<div id="rockBackground" style="background-image: url('assets/images/rps.jpg');">
<p class="portfolioTitle">Rock Paper Scissors</p>
</div>
</div>
<div id="row2">
<div id="rpg">
<div id="rpgBackground" style="background-image: url('assets/images/rpg.jpg');">
<p class="portfolioTitle">RPG Game</p>
</div>
<div id="rutgers">
<div id="rutgersBackground" style="background-image: url('assets/images/rutgers.jpg');">
<p class="portfolioTitle">Rutgers Info Widget</p>
</div>
</div>
</div>
</div>
</div>
</div> -->
<!-- Start of footer-->
<div id="footerBox">
<!-- Text for footer-->
<p id="cr1"> © Copyright</p>
</div>
</div>
</div>
</div>
</body>
</html>
I would suggest you use the id you have given the <ul> tag i.e boxlist and then apply the display as flex this way all your li elements will be in a flex box.Then work with the <li> elements as flex box elements here is a link that could help you out:-
https://www.w3schools.com/css/css3_flexbox.asp
I would highly recommend you to use grid as it can be more usefull and I like it better than flex box,here is the link you can use to refer how a grid box is used:-
https://www.w3schools.com/css/css_grid.asp
Gridview
<ul class="gridview grid-3">
<li><p>Hello<br>Hello</p></li>
<li><p>Hello<br>Hello<br>Hello<br>Hello</p></li>
<li><p>Hello</p></li>
<li><p>Hello<br>Hello<br>Hello</p></li>
<li><p>Hello</p></li>
<li><p>Hello<br>Hello</p></li>
<li><p>Hello</p></li>
<li><p>Hello<br>Hello<br>Hello</p></li>
<li><p>Hello</p></li>
<li><p>Hello<br>Hello</p></li>
</ul>
ul.gridview > li {
display: block;
float: left;
padding: 0;
margin: 0;
}
ul.gridview > li p {
background: #ddd;
padding: 5px;
margin: 0;
}
/* Grid-3 */
ul.grid-3 > li {
width: calc(100% / 3 - 2 * 10px / 3);
}
ul.grid-3 > li:nth-child(n + 4) {
margin-top: 10px;
}
ul.grid-3 > li:nth-child(3n + 1) {
clear: left;
}
ul.grid-3 > li:not(:nth-child(3n + 1)) {
margin-left: 10px;
}
/* Grid-4 */
ul.grid-4 > li {
width: calc(100% / 4 - 3 * 10px / 4);
}
ul.grid-4 > li:nth-child(n + 5) {
margin-top: 10px;
}
ul.grid-4 > li:nth-child(4n + 1) {
clear: left;
}
ul.grid-4 > li:not(:nth-child(4n + 1)) {
margin-left: 10px;
}
Codepen
Related
How can I make this textarea (the one with class="proxi-output" responsive?
When I try to resize the page it overlaps div (class="resi-gen") and it breaks the whole web.
*{
font-family: 'Montserrat', sans-serif;
}
body,
html{
margin: 0px;
padding: 0px;
background-image: url(../img/agreya-bg.png);
background-repeat: no-repeat;
background-size: cover;
background-color: #0E0E0E;
}
.side-panel{
background-color: #050707;
height: 100vh;
width: 250px;
margin: 0px;
z-index: 10;
position: absolute;
}
.logo{
margin: 0px;
color: #FFFFFF;
padding: 35px 20%;
letter-spacing: 2px;
}
.sub-pages{
text-align: center;
justify-content: center;
margin: 150px auto;
}
.sub-pages a{
display: block;
font-size: 20px;
text-decoration: none;
color: #FFFFFF;
margin: 45px 0px;
}
.sub-pages a:hover{
color: #E1E777;
}
#current{
color: #E1E777;
}
.heading{
color: #FFFFFF;
text-align: center;
font-weight: 500;
letter-spacing: 2px;
}
.wrapper{
float: right;
width: 100vw;
height: 100vh;
margin: 0px;
}
.resi-gen{
position: relative;
background-color: #050707;
margin-top: 20%;
width: 70%;
height: 45%;
border: 2px solid transparent;
border-radius: 50px;
/* width: 1100px;
height: 400px; */
margin-left: 290px;
}
.resi-gen h2{
display: inline-block;
color: #FFFFFF;
margin-top: 20px;
margin-left: 30px;
font-weight: 500;
letter-spacing: 1.5px;
}
#proxi-output{
position: absolute;
margin-top: 2%;
margin-left: 5%;
height: 85%;
width: 70%;
resize: none;
background-color: #818181;
cursor: pointer;
outline: none;
border: 2px solid transparent;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-border-radius: 50px;
-moz-border-radius: 50px;
border-radius: 50px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="css/residental.css">
<link href="https://fonts.googleapis.com/css2?family=Montserrat&display=swap" rel="stylesheet">
<script src="https://kit.fontawesome.com/29441bec37.js" crossorigin="anonymous"></script>
<title>Agreya - Register</title>
</head>
<body>
<div class="wrapper">
<div class="side-panel">
<h1 class="logo">AGREYA</h1>
<div class="sub-pages">
<a id="current" href="residental.html">Residental</a>
Datacenter
Purchase
Settings
</div>
</div>
<h1 class="heading">Residental proxies</h1>
<div class="resi-gen">
<h2>Generate Proxies</h2>
<textarea id="proxi-output" name="output"></textarea>
</div>
</div>
</body>
</html>
I want to move to the text area to align with other fields and then move all these fields to the down of the text "Feel free...." I was trying to use marigin-left, marigin-top, but nothing works. All the time these fields stay in one place. Do not know why.
It has to work on ip 6/7/8 plus resolution.
Could you tell me how can I achieve it?
* {
margin: 0;
padding: 0;
}
header {
width: 1920;
height: 1080px;
}
body {
display: flex;
flex-direction: column;
min-height: 100vh;
margin: 0;
height: 1080px;
background-image: linear-gradient(180deg, #EFEFEF00 0%, #0F4A37 100%);
}
footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: black;
color: white;
text-align: center;
}
footer img {
margin-top: 5px;
height: 30px;
display: inline-block;
padding: 0px 10px 0px 0px;
}
.main-nav {
float: right;
color: #000000;
margin-top: 40px;
margin-right: 0px;
}
.main-nav li {
display: inline-block;
}
.main-nav li a {
color: #000000;
text-decoration: none;
font: Bold 25px/15px Arial;
padding: 5px;
}
#logo {
margin-top: 10px;
float: left;
}
#tekst {
position: absolute;
}
#sign a {
background-color: #DCDFDE;
padding: 30px 15px 17px 15px;
border-top: 3px solid black;
border-bottom: 3px solid black;
border-left: 3px solid black;
border-right: 3px solid black;
}
#profilesign {
margin-top: 400px;
margin-left: 250px;
font: Bold 40px/40px Georgia;
letter-spacing: 0;
color: black;
}
.left {
-webkit-border-radius: 20px;
-khtml-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 150px 150px;
}
img.left {
padding: 0px 40px 20px 40px;
width: 250px;
height: 250px;
margin-left: 400px;
margin-top: 500px;
}
article input {
width: 300px;
height: 40px;
background: white;
border-radius: 4px;
text-decoration: none;
text-align: center;
font: Bold 25px/12px Arial;
border-radius: 120;
border-style: none;
padding: 6px;
margin-left: 1000px;
margin-top: 500px;
}
article #textSign {
font-size: 50px;
color: black;
text-align: center;
}
#centerText {
text-align: center;
}
#something {
width: 700px;
height: 300px;
text-align: justify;
margin-left: 1000px;
font-size: 30px;
font-weight: bold;
}
#media only screen and (max-device-width: 500px) {
#profilesign {
width: 1000px;
margin-top: 750px;
margin-left: 400px;
font: Bold 60px/40px Georgia;
letter-spacing: 0;
color: black;
}
img.left {
padding: 0px 40px 20px 40px;
width: 550px;
height: 550px;
margin-left: 550px;
margin-top: 450px;
}
footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
height: 60px;
background-color: black;
color: white;
text-align: center;
}
footer img {
margin-top: 5px;
height: 50px;
display: inline-block;
padding: 0px 10px 0px 0px;
}
#sign a {
background-color: #DCDFDE;
padding: 20px 15px 17px 1px;
border-top: 3px solid black;
border-bottom: 3px solid black;
border-left: 3px solid black;
border-right: 3px solid black;
}
#logo img {
margin-left: 550px;
text-align: center;
width: 650px;
}
body {
background-image: linear-gradient(180deg, #EFEFEF00 0%, #0F4A37 100%);
background-size: 100% 3000px;
width: auto;
}
.row {
width: 2500px;
display: grid;
grid-template-columns: 0% 80%;
}
.main-nav {
margin-left: 100px;
margin-top: 250px;
float: left;
display: inline-flex;
list-style: none;
}
.main-nav li a {
border-right: 3px solid black;
color: #000000;
text-decoration: none;
font: Bold 58px/45px Arial;
}
#something {
width: 700px;
height: 300px;
text-align: justify;
margin-top: 200px;
font-size: 30px;
font-weight: bold;
}
article input {
width: 400px;
height: 70px;
background: white;
border-radius: 4px;
text-decoration: none;
text-align: center;
font: Bold 45px/12px Arial;
border-radius: 120;
border-style: none;
padding: 6px;
margin-left: 700px;
}
}
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<title>DingDog</title>
<link rel="stylesheet" href="css-images/style-contact.css">
</head>
<body>
<header>
<div class="row">
<ul id="logo"> <img src="css-images/dingdog-logo.png"> </ul>
<ul class="main-nav">
<li style="padding-left:10px">PROFILE</li>
<li style="padding-left:10px">MAP</li>
<li style="padding-left:10px">YOUR FRIENDS</li>
<li style="padding-left:10px">MAILBOX</li>
<li style="padding-left:10px" id="sign">LOG OUT</li>
</ul>
</div>
<section>
<article>
<p id="profilesign">Feel free to send us a question.</p>
<img class="left" src="css-images/mial.jpg" style='position:absolute;left:0px; top:0px;' />
<div id="lala">
<p id="centerText">
<label><input type="email" name="email" placeholder="Email" style='margin-top:250px;position:absolute;left:0px; top:0px;' ></label><br/>
<label><input type="name" name="name" placeholder="Name" style="margin-top: 350px; position:absolute;left:0px; top:0px;"></label><br>
<label><input type="subject" name="subject" placeholder='Subject:' style="margin-top: 450px; position:absolute;left:0px; top:0px;"></label><br></p>
<textarea placeholder='Type something' id="something" style="margin-top: 550px; position:absolute;left:0px; top:0px;"></textarea>
</div>
<label id="submit"><input type="submit" name="send" value="Send" style="margin-top: 900px;position:absolute;left:0px; top:0px; background: #2699FB 0% 0% no-repeat padding-box;"></label>
</article>
</section>
</header>
<footer>
<img src="social/instagram.png" />
<img src="social/twitter-white-logo.png" />
<img src="social/facebook.png" />
</footer>
</body>
</html>
Despite having position fixed and no transform properties, my "hero" div always moves with the page. I want it to stay put
.hero{
position: fixed;
width: 1500px;
margin-left: 0px;
margin-top: 60px;
}
Full css:
*
{
margin: 0;
padding: 0;
}
header
{
background-image: linear-gradient(rgba(0, 0, 0, 0.5),rgba(0, 0, 0, 0.5)), url(img/snow.jpg);
height: 100vh;
background-size: cover;
background-position: center;
}
.main-nav
{
float: right;
list-style: none;
margin-top: 30px;
}
.main-nav li{
display: inline-block;
}
.main-nav li a{
color:white;
text-decoration: none;
padding: 5px 20px;
font-family: "Roboto", "sans-serif";
}
.main-nav li.active a{
border: 1px solid white;
}
.main-nav li a:hover{
border: 1px solid white;
}
.logo img
{
width: 150px;
height: auto;
float: left;
}
body
{
font-family: monospace;
}
.row
{
max-width: 1200px;
margin: auto;
}
.hero{
position: fixed;
width: 1500px;
margin-left: 0px;
margin-top: 60px;
}
h1{
color: white;
text-transform: uppercase;
font-size: 60px;
text-align: center;
/* margin-top: 275px; */
margin-top: 220;
}
.button
{
margin-top: 30px;
margin-left: 440px;
position: sticky;
}
.btn{
border: 1px solid white;
padding: 10px 30px;
color: white;
text-decoration: none;
margin-right: 5px;
font-size: 13px;
text-transform: uppercase;
position: sticky;
}
.btn-one{
background-color: darkorange;
font-family: "Roboto", sans-serif;
position: sticky;
}
.btn-two{
font-family: "Roboto", sans-serif;
position: sticky;
}
.btn-two:hover{
background-color: darkorange;
transition: all 0.5s ease-in;
}
html,body{
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
overflow-y: auto;
overflow-x: hidden;
}
#page_2{
height: 1000px;
background-color: red;
}
Full HTML:
<html>
<head>
<title>Summer Website</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
<div id="page_1">
<div id="particles-js">
<div class="row">
<!-- <div class ="logo">
<img src="https://i.imgur.com/0PyA8HR.png" alt="">
</div> -->
<ul class="main-nav">
<li class ="active"> HOME </li>
<li> ABOUT </li>
<li> PORTFOLIO </li>
</ul>
</div>
<div class="hero">
<h1>HI I'M KACIE AND I LOVE SOLVING PROBLEMS.</h1>
<div class="button">
LINKEDIN
RESUME
</div>
<div class ="bro">
</div>
</div>
</div>
</header>
<!--particles js file -->
<!-- <h1> TEST </h1> -->
<script type="text/javascript" src="js/particles.min.js"></script>
<script type="text/javascript" src="js/app.js"></script>
</div>
<div id=page_2>
</div>
</body>
</html>
There just seems to be problem with your closing tags incorrectly nested. There needs to another closing div before the closing header tag. The snippet shows the hero in a fixed position:
.hero {
position: fixed;
width: 1500px;
margin-left: 0px;
margin-top: 60px;
}
Full css: * {
margin: 0;
padding: 0;
}
header {
background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url(img/snow.jpg);
height: 100vh;
background-size: cover;
background-position: center;
}
.main-nav {
float: right;
list-style: none;
margin-top: 30px;
}
.main-nav li {
display: inline-block;
}
.main-nav li a {
color: white;
text-decoration: none;
padding: 5px 20px;
font-family: "Roboto", "sans-serif";
}
.main-nav li.active a {
border: 1px solid white;
}
.main-nav li a:hover {
border: 1px solid white;
}
.logo img {
width: 150px;
height: auto;
float: left;
}
body {
font-family: monospace;
}
.row {
max-width: 1200px;
margin: auto;
}
.hero {
position: fixed;
width: 1500px;
margin-left: 0px;
margin-top: 60px;
}
h1 {
color: white;
text-transform: uppercase;
font-size: 60px;
text-align: center;
/* margin-top: 275px; */
margin-top: 220;
}
.button {
margin-top: 30px;
margin-left: 440px;
position: sticky;
}
.btn {
border: 1px solid white;
padding: 10px 30px;
color: white;
text-decoration: none;
margin-right: 5px;
font-size: 13px;
text-transform: uppercase;
position: sticky;
}
.btn-one {
background-color: darkorange;
font-family: "Roboto", sans-serif;
position: sticky;
}
.btn-two {
font-family: "Roboto", sans-serif;
position: sticky;
}
.btn-two:hover {
background-color: darkorange;
transition: all 0.5s ease-in;
}
html,
body {
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
overflow-y: auto;
overflow-x: hidden;
}
#page_2 {
height: 1000px;
background-color: red;
}
<header>
<div id="page_1">
<div id="particles-js">
<div class="row">
<!-- <div class ="logo">
<img src="https://i.imgur.com/0PyA8HR.png" alt="">
</div> -->
<ul class="main-nav">
<li class="active"> HOME </li>
<li> ABOUT </li>
<li> PORTFOLIO </li>
</ul>
</div>
<div class="hero">
<h1>HI I'M KACIE AND I LOVE SOLVING PROBLEMS.</h1>
<div class="button">
LINKEDIN
RESUME
</div>
<div class="bro">
</div>
</div>
</div>
</div>
</header>
<div id=page_2>
</div>
Use position:inherit
You are using fixed and I think that is causing your issue.
Inherit won’t move, absolute stacks, fixed scrolls with page, static is default.
#charset "utf-8";
html{
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
body {
background: #F2F2F2;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
font-family: expresswayregular;
}
#font-face {
font-family: 'expresswayregular';
src: url('fonts/expressway_rg-webfont.woff2') format('woff2'),
url('fonts/expressway_rg-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
#header {
position: fixed;
background: #333333;
width: 100%;
height: 50px;
padding: 0;
margin: 0;
top: 0;
}
#header-content {
background: #333333;
width: 1280px;
height: 50px;
margin-left: auto;
margin-right: auto;
}
#logo {
position: absolute;
}
#currentsite-info font {
position: absolute;
height: 30px;
width: auto;
margin-left: 60px;
padding: 10px;
color: #fff;
font-size: 26px;
}
#search-box {
width: 400px;
height: 50px;
margin-right: auto;
margin-left: auto;
}
#search {
background: #fff;
width: 356px;
height: 16px;
margin-top: 10px;
margin-bottom: 10px;
padding: 6px;
border: 1px solid #fff;
border-radius: 6px 0 0 6px;
}
#submit {
float: right;
background: #fff;
width: 29px;
height: 28px;
margin-top: 10px;
margin-bottom: 10px;
padding: 0;
border-top: 1px solid #fff;
border-right: 1px solid #fff;
border-bottom: 1px solid #fff;
border-radius: 0 6px 6px 0;
}
#menu {
margin-right: 30px;
margin-left: 25px;
z-index: 1000;
}
.menu-linkbox a{
position: static;
float: right;
width: 60px;
height: 14px;
top: 0;
padding: 18px 15px 18px 15px;
color: #F2F2F2;
font-size: 14px;
text-decoration: none;
text-align: center;
}
.menu-linkbox:hover a {
color: #2997D3;
transition: all 500ms;
}
#menu-linkbox-live a {
color: #2997D3;
}
#main-content {
background: #fff;
min-height: 100%;
width: 1280px;
margin: 0 auto;
padding-top: 50px;
overflow: auto;
}
#content-articles {
background: #F2F2F2;
width: 1220px;
bottom: 0;
margin: 20px;
padding: 10px;
border: 1px solid #000;
overflow: auto;
}
#article1 {
width: 550px;
margin: 10px;
float: left;
text-align: justify;
word-spacing: 4px;
}
#article1 h1 {
font-size: 40px;
}
#article1-content {
width: 100%;
}
#photo1 {
width: 500px;
height: 500px;
margin: 0px auto;
border: 2px solid #2997D3;
display: block;
transition: all 500ms;
}
#photo1:hover {
opacity: 0.8;
}
#article2 {
width: 550px;
margin: 10px;
float: right;
text-align: justify;
word-spacing: 4px;
}
#article2 h1 {
font-size: 40px;
}
#article2-content {
width: 100%;
}
#photo2 {
width: 500px;
height: 500px;
margin: 0px auto;
border: 2px solid #2997D3;
display: block;
transition: all 500ms;
z-index: -1000;
}
#photo2:hover {
opacity: 0.8;
}
#article3 {
width: 550px;
margin: 60px 10px 10px 10px;
float: left;
text-align: justify;
word-spacing: 4px;
}
#article3 h1 {
font-size: 40px;
}
#article3-content {
width: 100%;
}
#photo3 {
width: 500px;
height: 500px;
margin: 0px auto;
border: 2px solid #2997D3;
display: block;
transition: all 500ms;
z-index: -1000;
}
#photo3:hover {
opacity: 0.8;
}
#article4 {
width: 550px;
margin: 60px 10px 10px 10px;
float: right;
text-align: justify;
word-spacing: 4px;
}
#article4 h1 {
font-size: 40px;
}
#article4-content {
width: 100%;
}
#photo4 {
width: 500px;
height: 500px;
margin: 0px auto;
border: 2px solid #2997D3;
display: block;
transition: all 500ms;
z-index: -1000;
}
#photo4:hover {
opacity: 0.8;
}
#imprint {
background: #333333;
bottom: 0;
width: 100%;
}
#imprint-content {
background: #333333;
width: 1280px;
height: 150px;
margin: auto;
}
#about-info {
width: 300px;
height: 130px;
float: left;
margin-left: 20px;
padding: 10px 20px 10px 20px;
vertical-align: middle;
font-size: 18px;
text-align: justify;
color: #fff;
}
#about-info h2 {
text-align: center;
}
#about-info p {
margin: 20px;
text-align: center;
vertical-align: middle;
}
#contact-info {
position: static;
width: 300px;
height: 130px;
margin-right: auto;
margin-left: auto;
padding: 10px 20px 10px 20px;
vertical-align: middle;
font-size: 18px;
text-align: justify;
color: #fff;
}
#contact-info h2 {
text-align: center;
}
#contact-info p {
margin: 20px;
text-align: center;
vertical-align: middle;
}
#legal-info {
width: 300px;
height: 130px;
float: right;
margin-right: 20px;
padding: 10px 20px 10px 20px;
vertical-align: middle;
font-size: 18px;
text-align: justify;
color: #fff;
}
#legal-info h2 {
text-align: center;
}
#legal-info p {
margin: 20px;
text-align: center;
vertical-align: middle;
}
h1 {
color: #2997D3;
font-size: 20px;
text-align: center;
margin-bottom: 20px;
}
p {
margin: 20px;
}
a {
color: #2997D3;
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="stylesheet_topics.css">
<link rel="icon" href="images/logo_site.png">
<title>Topics</title>
<script>
function toggleNavPanel(x){
var panel = document.getElementById(x), navarrow = document.getElementById("navarrow"), maxH="300px";
if(panel.style.height == maxH){
panel.style.height = "0px";
navarrow.innerHTML = "▾";
}
else {
panel.style.height = maxH;
navarrow.innerHTML = "▴";
}
}
</script>
</head>
<body>
<div id="header">
<div id="header-content">
<img id ="logo" src="images/logo.png" />
<div id="currentsite-info">
<font>Topics</font>
</div>
<div id="menu">
<div class="menu-linkbox" id="menu-linkbox-breaking">Breaking</div>
<div class="menu-linkbox" id="menu-linkbox-live">Topics</div>
<div class="menu-linkbox" id="menu-linkbox-scene">News</div>
<div class="menu-linkbox" id="menu-linkbox-home">Overview</div>
</div>
<div id="search-box">
<form action="http://www.google.com/search" method="get">
<input id="search" type="text" name="q" placeholder="Search">
<input id="submit" type="image" src="images/search.png" alt="Submit">
</form>
</div>
</div>
</div>
<div id="main-content">
<div id="content-articles">
<div id="article1">
<div id="article1-content">
<h1>Politics</h1>
</div>
<div id="article1-photo">
<img id ="photo1" src="images/footage/topic1adjusted.jpeg" />
</div>
</div>
<div id="article2">
<div id="article2-content">
<h1>Healthcare</h1>
</div>
<div id="article2-photo">
<img id ="photo2" src="images/footage/topic2.jpeg" />
</div>
</div>
<div id="article3">
<div id="article3-content">
<h1>Network</h1>
</div>
<div id="article3-photo">
<img id ="photo3" src="images/footage/topic3adjusted.jpeg" />
</div>
</div>
<div id="article4">
<div id="article4-content">
<h1>Travel</h1>
</div>
<div id="article4-photo">
<img id ="photo4" src="images/footage/topic4adjusted.jpeg" />
</div>
</div>
</div>
</div>
<div id="imprint">
<div id="imprint-content">
<div id="about-info">
<h2>About Us</h2>
<p>
Company information
</p>
</div>
<div id="legal-info">
<h2>Legal Use</h2>
<p>
Copyright information
</p>
</div>
<div id="contact-info">
<h2>Contact</h2>
<p>
Contact information
</p>
</div>
</div>
</div>
</body>
</html>
Hello I have given you a snippet with my current website. It has 4 pictures and a fixed header. When you hover over the picture their opacity is being changed (1->0.8). My problem is that they are also goin over the header... I tried using a z-index but it's not working, any ideas on how to get them behind the header ?
z-index only works on positioned elements
So, I've added position: relative to #photo1 and z-index: 1 to header.
Bonus - added a link to hosted photo instead of the non-working local paths you gave, so you can see it work.
#charset "utf-8";
html{
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
body {
background: #F2F2F2;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
font-family: expresswayregular;
}
#font-face {
font-family: 'expresswayregular';
src: url('fonts/expressway_rg-webfont.woff2') format('woff2'),
url('fonts/expressway_rg-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
#header {
position: fixed;
background: #333333;
width: 100%;
height: 50px;
padding: 0;
margin: 0;
top: 0;
z-index: 1;
}
#header-content {
background: #333333;
width: 1280px;
height: 50px;
margin-left: auto;
margin-right: auto;
}
#logo {
position: absolute;
}
#currentsite-info font {
position: absolute;
height: 30px;
width: auto;
margin-left: 60px;
padding: 10px;
color: #fff;
font-size: 26px;
}
#search-box {
width: 400px;
height: 50px;
margin-right: auto;
margin-left: auto;
}
#search {
background: #fff;
width: 356px;
height: 16px;
margin-top: 10px;
margin-bottom: 10px;
padding: 6px;
border: 1px solid #fff;
border-radius: 6px 0 0 6px;
}
#submit {
float: right;
background: #fff;
width: 29px;
height: 28px;
margin-top: 10px;
margin-bottom: 10px;
padding: 0;
border-top: 1px solid #fff;
border-right: 1px solid #fff;
border-bottom: 1px solid #fff;
border-radius: 0 6px 6px 0;
}
#menu {
margin-right: 30px;
margin-left: 25px;
z-index: 1000;
}
.menu-linkbox a{
position: static;
float: right;
width: 60px;
height: 14px;
top: 0;
padding: 18px 15px 18px 15px;
color: #F2F2F2;
font-size: 14px;
text-decoration: none;
text-align: center;
}
.menu-linkbox:hover a {
color: #2997D3;
transition: all 500ms;
}
#menu-linkbox-live a {
color: #2997D3;
}
#main-content {
background: #fff;
min-height: 100%;
width: 1280px;
margin: 0 auto;
padding-top: 50px;
overflow: auto;
}
#content-articles {
background: #F2F2F2;
width: 1220px;
bottom: 0;
margin: 20px;
padding: 10px;
border: 1px solid #000;
overflow: auto;
}
#article1 {
width: 550px;
margin: 10px;
float: left;
text-align: justify;
word-spacing: 4px;
}
#article1 h1 {
font-size: 40px;
}
#article1-content {
width: 100%;
}
#photo1 {
width: 500px;
height: 500px;
margin: 0px auto;
border: 2px solid #2997D3;
display: block;
transition: all 500ms;
position: relative;
}
#photo1:hover {
opacity: 0.8;
}
#article2 {
width: 550px;
margin: 10px;
float: right;
text-align: justify;
word-spacing: 4px;
}
#article2 h1 {
font-size: 40px;
}
#article2-content {
width: 100%;
}
#photo2 {
width: 500px;
height: 500px;
margin: 0px auto;
border: 2px solid #2997D3;
display: block;
transition: all 500ms;
z-index: -1000;
}
#photo2:hover {
opacity: 0.8;
}
#article3 {
width: 550px;
margin: 60px 10px 10px 10px;
float: left;
text-align: justify;
word-spacing: 4px;
}
#article3 h1 {
font-size: 40px;
}
#article3-content {
width: 100%;
}
#photo3 {
width: 500px;
height: 500px;
margin: 0px auto;
border: 2px solid #2997D3;
display: block;
transition: all 500ms;
z-index: -1000;
}
#photo3:hover {
opacity: 0.8;
}
#article4 {
width: 550px;
margin: 60px 10px 10px 10px;
float: right;
text-align: justify;
word-spacing: 4px;
}
#article4 h1 {
font-size: 40px;
}
#article4-content {
width: 100%;
}
#photo4 {
width: 500px;
height: 500px;
margin: 0px auto;
border: 2px solid #2997D3;
display: block;
transition: all 500ms;
z-index: -1000;
}
#photo4:hover {
opacity: 0.8;
}
#imprint {
background: #333333;
bottom: 0;
width: 100%;
}
#imprint-content {
background: #333333;
width: 1280px;
height: 150px;
margin: auto;
}
#about-info {
width: 300px;
height: 130px;
float: left;
margin-left: 20px;
padding: 10px 20px 10px 20px;
vertical-align: middle;
font-size: 18px;
text-align: justify;
color: #fff;
}
#about-info h2 {
text-align: center;
}
#about-info p {
margin: 20px;
text-align: center;
vertical-align: middle;
}
#contact-info {
position: static;
width: 300px;
height: 130px;
margin-right: auto;
margin-left: auto;
padding: 10px 20px 10px 20px;
vertical-align: middle;
font-size: 18px;
text-align: justify;
color: #fff;
}
#contact-info h2 {
text-align: center;
}
#contact-info p {
margin: 20px;
text-align: center;
vertical-align: middle;
}
#legal-info {
width: 300px;
height: 130px;
float: right;
margin-right: 20px;
padding: 10px 20px 10px 20px;
vertical-align: middle;
font-size: 18px;
text-align: justify;
color: #fff;
}
#legal-info h2 {
text-align: center;
}
#legal-info p {
margin: 20px;
text-align: center;
vertical-align: middle;
}
h1 {
color: #2997D3;
font-size: 20px;
text-align: center;
margin-bottom: 20px;
}
p {
margin: 20px;
}
a {
color: #2997D3;
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="stylesheet_topics.css">
<link rel="icon" href="images/logo_site.png">
<title>Topics</title>
<script>
function toggleNavPanel(x){
var panel = document.getElementById(x), navarrow = document.getElementById("navarrow"), maxH="300px";
if(panel.style.height == maxH){
panel.style.height = "0px";
navarrow.innerHTML = "▾";
}
else {
panel.style.height = maxH;
navarrow.innerHTML = "▴";
}
}
</script>
</head>
<body>
<div id="header">
<div id="header-content">
<img id ="logo" src="images/logo.png" />
<div id="currentsite-info">
<font>Topics</font>
</div>
<div id="menu">
<div class="menu-linkbox" id="menu-linkbox-breaking">Breaking</div>
<div class="menu-linkbox" id="menu-linkbox-live">Topics</div>
<div class="menu-linkbox" id="menu-linkbox-scene">News</div>
<div class="menu-linkbox" id="menu-linkbox-home">Overview</div>
</div>
<div id="search-box">
<form action="http://www.google.com/search" method="get">
<input id="search" type="text" name="q" placeholder="Search">
<input id="submit" type="image" src="images/search.png" alt="Submit">
</form>
</div>
</div>
</div>
<div id="main-content">
<div id="content-articles">
<div id="article1">
<div id="article1-content">
<h1>Politics</h1>
</div>
<div id="article1-photo">
<img id ="photo1" src="http://www.mtv.com/crop-images/2013/09/11/Foo%20Fighters%20officail.jpg" />
</div>
</div>
<div id="article2">
<div id="article2-content">
<h1>Healthcare</h1>
</div>
<div id="article2-photo">
<img id ="photo2" src="images/footage/topic2.jpeg" />
</div>
</div>
<div id="article3">
<div id="article3-content">
<h1>Network</h1>
</div>
<div id="article3-photo">
<img id ="photo3" src="images/footage/topic3adjusted.jpeg" />
</div>
</div>
<div id="article4">
<div id="article4-content">
<h1>Travel</h1>
</div>
<div id="article4-photo">
<img id ="photo4" src="images/footage/topic4adjusted.jpeg" />
</div>
</div>
</div>
</div>
<div id="imprint">
<div id="imprint-content">
<div id="about-info">
<h2>About Us</h2>
<p>
Company information
</p>
</div>
<div id="legal-info">
<h2>Legal Use</h2>
<p>
Copyright information
</p>
</div>
<div id="contact-info">
<h2>Contact</h2>
<p>
Contact information
</p>
</div>
</div>
</div>
</body>
</html>
I added z-index properties to your #header and #main-content css classes and there is no longer any overlap on hover.
I've also removed the z-index values you set on the images themselves (#photo1 etc) as the z-index set on #main-content applies to them as well, as they are its children.
Hope this helps.
#charset "utf-8";
html{
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
body {
background: #F2F2F2;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
font-family: expresswayregular;
}
#font-face {
font-family: 'expresswayregular';
src: url('fonts/expressway_rg-webfont.woff2') format('woff2'),
url('fonts/expressway_rg-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
#header {
position: fixed;
background: #333333;
width: 100%;
height: 50px;
padding: 0;
margin: 0;
top: 0;
z-index: 1;
}
#header-content {
background: #333333;
width: 1280px;
height: 50px;
margin-left: auto;
margin-right: auto;
}
#logo {
position: absolute;
}
#currentsite-info font {
position: absolute;
height: 30px;
width: auto;
margin-left: 60px;
padding: 10px;
color: #fff;
font-size: 26px;
}
#search-box {
width: 400px;
height: 50px;
margin-right: auto;
margin-left: auto;
}
#search {
background: #fff;
width: 356px;
height: 16px;
margin-top: 10px;
margin-bottom: 10px;
padding: 6px;
border: 1px solid #fff;
border-radius: 6px 0 0 6px;
}
#submit {
float: right;
background: #fff;
width: 29px;
height: 28px;
margin-top: 10px;
margin-bottom: 10px;
padding: 0;
border-top: 1px solid #fff;
border-right: 1px solid #fff;
border-bottom: 1px solid #fff;
border-radius: 0 6px 6px 0;
}
#menu {
margin-right: 30px;
margin-left: 25px;
z-index: 1000;
}
.menu-linkbox a{
position: static;
float: right;
width: 60px;
height: 14px;
top: 0;
padding: 18px 15px 18px 15px;
color: #F2F2F2;
font-size: 14px;
text-decoration: none;
text-align: center;
}
.menu-linkbox:hover a {
color: #2997D3;
transition: all 500ms;
}
#menu-linkbox-live a {
color: #2997D3;
}
#main-content {
background: #fff;
min-height: 100%;
width: 1280px;
margin: 0 auto;
padding-top: 50px;
overflow: auto;
z-index: -1;
}
#content-articles {
background: #F2F2F2;
width: 1220px;
bottom: 0;
margin: 20px;
padding: 10px;
border: 1px solid #000;
overflow: auto;
}
#article1 {
width: 550px;
margin: 10px;
float: left;
text-align: justify;
word-spacing: 4px;
}
#article1 h1 {
font-size: 40px;
}
#article1-content {
width: 100%;
}
#photo1 {
width: 500px;
height: 500px;
margin: 0px auto;
border: 2px solid #2997D3;
display: block;
transition: all 500ms;
}
#photo1:hover {
opacity: 0.8;
}
#article2 {
width: 550px;
margin: 10px;
float: right;
text-align: justify;
word-spacing: 4px;
}
#article2 h1 {
font-size: 40px;
}
#article2-content {
width: 100%;
}
#photo2 {
width: 500px;
height: 500px;
margin: 0px auto;
border: 2px solid #2997D3;
display: block;
transition: all 500ms;
}
#photo2:hover {
opacity: 0.8;
}
#article3 {
width: 550px;
margin: 60px 10px 10px 10px;
float: left;
text-align: justify;
word-spacing: 4px;
}
#article3 h1 {
font-size: 40px;
}
#article3-content {
width: 100%;
}
#photo3 {
width: 500px;
height: 500px;
margin: 0px auto;
border: 2px solid #2997D3;
display: block;
transition: all 500ms;
}
#photo3:hover {
opacity: 0.8;
}
#article4 {
width: 550px;
margin: 60px 10px 10px 10px;
float: right;
text-align: justify;
word-spacing: 4px;
}
#article4 h1 {
font-size: 40px;
}
#article4-content {
width: 100%;
}
#photo4 {
width: 500px;
height: 500px;
margin: 0px auto;
border: 2px solid #2997D3;
display: block;
transition: all 500ms;
}
#photo4:hover {
opacity: 0.8;
}
#imprint {
background: #333333;
bottom: 0;
width: 100%;
}
#imprint-content {
background: #333333;
width: 1280px;
height: 150px;
margin: auto;
}
#about-info {
width: 300px;
height: 130px;
float: left;
margin-left: 20px;
padding: 10px 20px 10px 20px;
vertical-align: middle;
font-size: 18px;
text-align: justify;
color: #fff;
}
#about-info h2 {
text-align: center;
}
#about-info p {
margin: 20px;
text-align: center;
vertical-align: middle;
}
#contact-info {
position: static;
width: 300px;
height: 130px;
margin-right: auto;
margin-left: auto;
padding: 10px 20px 10px 20px;
vertical-align: middle;
font-size: 18px;
text-align: justify;
color: #fff;
}
#contact-info h2 {
text-align: center;
}
#contact-info p {
margin: 20px;
text-align: center;
vertical-align: middle;
}
#legal-info {
width: 300px;
height: 130px;
float: right;
margin-right: 20px;
padding: 10px 20px 10px 20px;
vertical-align: middle;
font-size: 18px;
text-align: justify;
color: #fff;
}
#legal-info h2 {
text-align: center;
}
#legal-info p {
margin: 20px;
text-align: center;
vertical-align: middle;
}
h1 {
color: #2997D3;
font-size: 20px;
text-align: center;
margin-bottom: 20px;
}
p {
margin: 20px;
}
a {
color: #2997D3;
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="stylesheet_topics.css">
<link rel="icon" href="images/logo_site.png">
<title>Topics</title>
<script>
function toggleNavPanel(x){
var panel = document.getElementById(x), navarrow = document.getElementById("navarrow"), maxH="300px";
if(panel.style.height == maxH){
panel.style.height = "0px";
navarrow.innerHTML = "▾";
}
else {
panel.style.height = maxH;
navarrow.innerHTML = "▴";
}
}
</script>
</head>
<body>
<div id="header">
<div id="header-content">
<img id ="logo" src="images/logo.png" />
<div id="currentsite-info">
<font>Topics</font>
</div>
<div id="menu">
<div class="menu-linkbox" id="menu-linkbox-breaking">Breaking</div>
<div class="menu-linkbox" id="menu-linkbox-live">Topics</div>
<div class="menu-linkbox" id="menu-linkbox-scene">News</div>
<div class="menu-linkbox" id="menu-linkbox-home">Overview</div>
</div>
<div id="search-box">
<form action="http://www.google.com/search" method="get">
<input id="search" type="text" name="q" placeholder="Search">
<input id="submit" type="image" src="images/search.png" alt="Submit">
</form>
</div>
</div>
</div>
<div id="main-content">
<div id="content-articles">
<div id="article1">
<div id="article1-content">
<h1>Politics</h1>
</div>
<div id="article1-photo">
<img id ="photo1" src="images/footage/topic1adjusted.jpeg" />
</div>
</div>
<div id="article2">
<div id="article2-content">
<h1>Healthcare</h1>
</div>
<div id="article2-photo">
<img id ="photo2" src="images/footage/topic2.jpeg" />
</div>
</div>
<div id="article3">
<div id="article3-content">
<h1>Network</h1>
</div>
<div id="article3-photo">
<img id ="photo3" src="images/footage/topic3adjusted.jpeg" />
</div>
</div>
<div id="article4">
<div id="article4-content">
<h1>Travel</h1>
</div>
<div id="article4-photo">
<img id ="photo4" src="images/footage/topic4adjusted.jpeg" />
</div>
</div>
</div>
</div>
<div id="imprint">
<div id="imprint-content">
<div id="about-info">
<h2>About Us</h2>
<p>
Company information
</p>
</div>
<div id="legal-info">
<h2>Legal Use</h2>
<p>
Copyright information
</p>
</div>
<div id="contact-info">
<h2>Contact</h2>
<p>
Contact information
</p>
</div>
</div>
</div>
</body>
</html>
I am designing a homepage template. When I finished with my center content I started making the footer. I quickly realized my footer is not at the bottom of the page but instead inside the center content and cannot figure out why.
HTML:
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="file://C:/Workspace/MyWeblogicWorkspace/Purify/WebContent/CSS/index.css">
<link href='https://fonts.googleapis.com/css?family=PT+Sans:400,700' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="header">
<div id="navigationBar">
<ul id="navigationBarList">
<li><a id="test" href="http://www.google.com">Home</a></li>
<li>About</li>
<li>Services</li>
<li>Contact</li>
</ul>
</div><!-- end of navigationBar -->
</div><!-- end of header -->
<div id="center">
<p id="title">*******************</p>
<p id="slogan">*******************</p>
<div id="centerContent">
<div id="contentOneBox">
<p id="contentOneTitle">*******************</p>
<p id="contentOneText">*******************!</p>
</div><!-- end of contentOneBox -->
<div id="contentTwoBox">
<p id="contentTwoTitle">*******************</p>
<p id="contentTwoText">**************************************.</p>
</div><!-- end of contentTwoBox -->
<div id="contentThreeBox">
<p id="contentThreeTitle">*******************</p>
<p id="contentThreeText">**************************************.</p>
</div><!-- end of contentThreeBox -->
<div id="contentFourBox">
<p id="contentFourTitle">*******************</p>
<p id="contentFourText">**************************************.</p>
</div><!-- end of contentFourBox -->
</div><!-- end of centerContent -->
</div><!-- end of center -->
<div id="footer">
<p id="contact">*******************</p>
<p id="copyright">*******************</p>
</div><!-- end of footer -->
</body>
</html>
CSS:
* {
padding: 0;
margin: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
font-size: 62.5%;
font-family: 'PT Sans', sans-serif;
color: #221F51;
}
#header {
display: block;
position: relative;
top: 0;
right: 0;
left: 0;
z-index: 9999;
margin: 0;
width: 100%;
min-width: 1024px;
height: 48px;
max-height: 44px;
background: #333;
background: rgba(0,0,0,0.8);
font-size: 18px;
-webkit-user-select: none;
}
#navigationBar {
display: block;
margin: 0 auto;
padding: 0 auto;
position: relative;
text-align: center;
}
#navigationBar ul li {
display: inline-block;
margin: 0 auto;
padding: 10px;
padding-left: 20px;
padding-right: 20px;
}
#navigationBar ul li a {
color: white;
margin: 0 auto;
padding: 0 auto;
text-decoration: none;
}
#navigationBar ul li a:hover {
color: gray;
}
#center {
display: block;
font-size: 18px;
position: relative;
}
#title {
display: block;
font-size: 48px;
letter-spacing: 3px;
margin-top: 25px;
padding: 25px;
position: relative;
text-align: center;
}
#slogan {
display: block;
font-size: 22px;
margin: 0 auto;
padding: 0 auto;
position: relative;
text-align: center;
}
#centerContent {
display: block;
font-size: 22px;
margin: 0 auto;
padding: 0 auto;
position: relative;
width: 990px;
}
#contentOneBox {
border: 1px solid black;
border-radius: 15px;
display: block;
float: left;
margin: 50px;
padding: 0px;
position: relative;
width: 350px;
}
#contentOneTitle {
background: #333;
background: rgba(0,0,0,0.8);
border-top-left-radius: 15px;
border-top-right-radius: 15px;
color: white;
display: block;
letter-spacing: 2px;
margin: 0;
padding: 2px;
position: relative;
text-align: center;
}
#contentOneText {
border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
display: block;
height: 97px;
padding: 5px;
position: relative;
text-align: center;
}
#contentTwoBox {
border: 1px solid black;
border-radius: 15px;
display: block;
float: right;
margin: 50px;
padding: 0px;
position: relative;
width: 350px;
}
#contentTwoTitle {
background: #333;
background: rgba(0,0,0,0.8);
border-top-left-radius: 15px;
border-top-right-radius: 15px;
color: white;
display: block;
letter-spacing: 2px;
margin: 0;
padding: 2px;
position: relative;
text-align: center;
}
#contentTwoText {
border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
display: block;
height: 97px;
padding: 5px;
position: relative;
text-align: center;
}
#contentThreeBox {
border: 1px solid black;
border-radius: 15px;
display: block;
float: left;
margin: 50px;
padding: 0px;
position: relative;
width: 350px;
}
#contentThreeTitle {
background: #333;
background: rgba(0,0,0,0.8);
border-top-left-radius: 15px;
border-top-right-radius: 15px;
color: white;
display: block;
letter-spacing: 2px;
margin: 0;
padding: 2px;
position: relative;
text-align: center;
}
#contentThreeText {
border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
display: block;
height: 97px;
padding: 5px;
position: relative;
text-align: center;
}
#contentFourBox {
border: 1px solid black;
border-radius: 15px;
display: block;
float: right;
margin: 50px;
padding: 0px;
position: relative;
width: 350px;
}
#contentFourTitle {
background: #333;
background: rgba(0,0,0,0.8);
border-top-left-radius: 15px;
border-top-right-radius: 15px;
color: white;
display: block;
letter-spacing: 2px;
margin: 0;
padding: 2px;
position: relative;
text-align: center;
}
#contentFourText {
border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
display: block;
height: 97px;
padding: 5px;
position: relative;
text-align: center;
}
#footer {
background-color: #f2f2f2;
display: block;
position: relative;
margin: 0;
width: 100%;
min-width: 1024px;
font-size: 14px;
-webkit-user-select: none;
}
#contact {
display: block;
position: relative;
text-align: center;
}
#copyright {
display: block;
position: relative;
text-align: center;
}
Here's fiddle : https://jsfiddle.net/c74dy9dj/
Try to add clear: both; to footer CSS:
#footer {
background-color: #f2f2f2;
display: block;
position: relative;
margin: 0;
width: 100%;
min-width: 1024px;
font-size: 14px;
-webkit-user-select: none;
border: 1px gray dotted;
background-color: rgba(120,120,120,.5);
clear: both; /* <-- check this out! */
}
You're using floats which causes elements after a floating element to flow around it.
Here is a good explanation
https://css-tricks.com/almanac/properties/c/clear/
You can fix this by adding "clear: both" to #footer
#footer {
clear:both;
}