I have a fixed navigation menu at the top of my webpage and another one on the right side of the webpage. However my top (fixed) navigation menu causes the scrollbar to go behind the navigation menu div. I have tried searching for solutions and found that I should delete overflow: auto in my html, body selectors. However if I do that, then the navigation menu on the right side doesn't extend to the full height of the document (100%). How can I fix this?
html,
body {
height: 100%;
background-color: white;
margin: 0px;
padding: 0px;
font-family: "Gill Sans", sans-serif;
overflow: auto;
z-index: 50;
}
body {
min-height: 100%;
}
.navigation-menu {
position: fixed;
top: 0px;
width: 100%;
background-color: black;
z-index: 60;
}
.menu {
position: relative;
top: 0px;
list-style: none;
padding: 0px;
margin: 0px;
background-color: #6157CC;
}
.navigation-menu a {
float: left;
padding: 15px 20px;
color: white;
text-decoration: none;
}
h1 {
color: #6157CC;
text-align: center;
position: relative;
top: 90px;
z-index: 1;
margin: 0px 0px 0px 170px;
}
.contents {
float: left;
position: absolute;
width: 15%;
height: 100%;
background-color: red;
z-index: 5;
display: block;
overflow: auto;
}
#plants {
list-style: none;
position: absolute;
top: 3%;
text-align: center;
}
#plants a {
position: relative;
display: block;
padding: 25px 10px;
top: 20px;
color: white;
text-decoration: none;
}
.plants-definition {
position: relative;
float: right;
width: 85%;
top: 80px;
left: 0px;
}
p {
margin: 20px 50px;
}
h2 {
padding: 55px 0px 0px 0px;
margin: 0px 50px;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="Nature.CSS">
<meta charset="UTF-8">
<title>Nature</title>
</head>
<body>
<div class="navigation-menu">
<nav>
<ul class="menu">
<li><a>Home</a></li>
<li><a>Plants</a></li>
<li><a>Animals</a></li>
<li><a>Oceans</a></li>
</ul>
</nav>
</div>
<div class="contents">
<ul id="plants">
<li><a>Trees</a></li>
<li><a>Flowers</a></li>
<li><a>Water Plants</a></li>
</ul>
</div>
<div>
<h1>Plants</h1>
</div>
<div class="plants-definition">
<h2>Trees</h2>
<p>In botany, a tree is a perennial plant with an elongated stem, or trunk, supporting branches and leaves in most species. In some usages, the definition of a tree may be narrower, including only woody plants with secondary growth, plants that are usable
as lumber or plants above a specified height. Trees are not a taxonomic group but include a variety of plant species that have independently evolved a woody trunk and branches as a way to tower above other plants to compete for sunlight. Trees tend
to be long-lived, some reaching several thousand years old. In wider definitions, the taller palms, tree ferns, bananas, and bamboos are also trees. Trees have been in existence for 370 million years. It is estimated that there are just over 3 trillion
mature trees in the world</p>
</div>
<div>
<h2>Flowers</h2>
<p></p>
</div>
<div class="plants-definition">
<h2>Flowers</h2>
<p>A flower, sometimes known as a bloom or blossom, is the reproductive structure found in flowering plants (plants of the division Magnoliophyta, also called angiosperms). The biological function of a flower is to effect reproduction, usually by providing
a mechanism for the union of sperm with eggs. Flowers may facilitate outcrossing (fusion of sperm and eggs from different individuals in a population) or allow selfing (fusion of sperm and egg from the same flower). Some flowers produce diaspores
without fertilization (parthenocarpy). Flowers contain sporangia and are the site where gametophytes develop. Many flowers have evolved to be attractive to animals, so as to cause them to be vectors for the transfer of pollen. After fertilization,
the ovary of the flower develops into fruit containing seeds.</p>
</div>
<div class="plants-definition">
<h2>Water Plants</h2>
<p>Aquatic plants are plants that have adapted to living in aquatic environments (saltwater or freshwater). They are also referred to as hydrophytes or macrophytes. A macrophyte is an aquatic plant that grows in or near water and is either emergent,
submergent, or floating, and includes helophytes (a plant that grows in marsh, partly submerged in water, so that it regrows from buds below the water surface).[1] In lakes and rivers macrophytes provide cover for fish and substrate for aquatic
invertebrates, produce oxygen, and act as food for some fish and wildlife.</p>
</div>
</body>
</html>
https://jsfiddle.net/e679hmx4/2/
(I know it doesn't look pretty at all now, but I think you should be able to understand the general idea).
Your issue is because of overflow: auto on your html, body. If you remove this your scrollbar will appear as expected:
html, body {
height: 100%;
background-color: white;
margin: 0px;
padding: 0px;
font-family: "Gill Sans", sans-serif;
overflow: auto;
z-index: 50;
}
Once you've done this, you'll also need to set your side navbar (.content) to position: fixed such that it fills the correct height.
See example below:
html,
body {
height: 100%;
background-color: white;
margin: 0px;
padding: 0px;
font-family: "Gill Sans", sans-serif;
z-index: 50;
}
body {
min-height: 100%;
}
.navigation-menu {
position: fixed;
top: 0px;
width: 100%;
background-color: black;
z-index: 60;
}
.menu {
position: relative;
top: 0px;
list-style: none;
padding: 0px;
margin: 0px;
background-color: #6157CC;
}
.navigation-menu a {
float: left;
padding: 15px 20px;
color: white;
text-decoration: none;
}
h1 {
color: #6157CC;
text-align: center;
position: relative;
top: 90px;
z-index: 1;
margin: 0px 0px 0px 170px;
}
.contents {
float: left;
position: fixed;
/* change position to fixed */
width: 15%;
height: 100%;
background-color: red;
z-index: 5;
display: block;
overflow: auto;
}
#plants {
list-style: none;
position: absolute;
top: 3%;
text-align: center;
}
#plants a {
position: relative;
display: block;
padding: 25px 10px;
top: 20px;
color: white;
text-decoration: none;
}
.plants-definition {
position: relative;
float: right;
width: 85%;
top: 80px;
left: 0px;
}
p {
margin: 20px 50px;
}
h2 {
padding: 55px 0px 0px 0px;
margin: 0px 50px;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="Nature.CSS">
<meta charset="UTF-8">
<title>Nature</title>
</head>
<body>
<div class="navigation-menu">
<nav>
<ul class="menu">
<li><a>Home</a></li>
<li><a>Plants</a></li>
<li><a>Animals</a></li>
<li><a>Oceans</a></li>
</ul>
</nav>
</div>
<div class="contents">
<ul id="plants">
<li><a>Trees</a></li>
<li><a>Flowers</a></li>
<li><a>Water Plants</a></li>
</ul>
</div>
<div>
<h1>Plants</h1>
</div>
<div class="plants-definition">
<h2>Trees</h2>
<p>In botany, a tree is a perennial plant with an elongated stem, or trunk, supporting branches and leaves in most species. In some usages, the definition of a tree may be narrower, including only woody plants with secondary growth, plants that are usable
as lumber or plants above a specified height. Trees are not a taxonomic group but include a variety of plant species that have independently evolved a woody trunk and branches as a way to tower above other plants to compete for sunlight. Trees tend
to be long-lived, some reaching several thousand years old. In wider definitions, the taller palms, tree ferns, bananas, and bamboos are also trees. Trees have been in existence for 370 million years. It is estimated that there are just over 3 trillion
mature trees in the world</p>
</div>
<div>
<h2>Flowers</h2>
<p></p>
</div>
<div class="plants-definition">
<h2>Flowers</h2>
<p>A flower, sometimes known as a bloom or blossom, is the reproductive structure found in flowering plants (plants of the division Magnoliophyta, also called angiosperms). The biological function of a flower is to effect reproduction, usually by providing
a mechanism for the union of sperm with eggs. Flowers may facilitate outcrossing (fusion of sperm and eggs from different individuals in a population) or allow selfing (fusion of sperm and egg from the same flower). Some flowers produce diaspores
without fertilization (parthenocarpy). Flowers contain sporangia and are the site where gametophytes develop. Many flowers have evolved to be attractive to animals, so as to cause them to be vectors for the transfer of pollen. After fertilization,
the ovary of the flower develops into fruit containing seeds.</p>
</div>
<div class="plants-definition">
<h2>Water Plants</h2>
<p>Aquatic plants are plants that have adapted to living in aquatic environments (saltwater or freshwater). They are also referred to as hydrophytes or macrophytes. A macrophyte is an aquatic plant that grows in or near water and is either emergent,
submergent, or floating, and includes helophytes (a plant that grows in marsh, partly submerged in water, so that it regrows from buds below the water surface).[1] In lakes and rivers macrophytes provide cover for fish and substrate for aquatic
invertebrates, produce oxygen, and act as food for some fish and wildlife.</p>
</div>
</body>
</html>
Removing overflow: auto; on html, body will stop this from happening, also I would avoid adding z-index to body and html tags.
Related
`This is my CSS code;
/*homepage*/
#import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght#400;700&display=swap');
#import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght#400;700&family=PT+Sans&display=swap');
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-family: 'Open Sans';
font-size: 18px;
}
#hero {
width: 100%;
height: 100vh;
background: linear-gradient(rgba(0, 0, 0, 0.350),rgba(0, 0, 0, 0.350)), url('./bilder/welcome.jpg') no-repeat center / cover ;
color: white;
}
.navbar {
display: flex;
margin: right auto;
float: right;
}
.navbar nav {
display: block;
padding-right: 12px;
}
.navbar a {
color: white;
font-size: 0.9rem;
font-weight: bold;
text-decoration: none;
line-height: 60px;
padding: 0.4em 0.9em;
border: 2px solid;
border-color: white;
border-radius: 20px;
margin: 9px;
transition: 0.3s;
box-shadow: rgba(0, 0, 0, 0.16) 0px 3px 6px, rgba(0, 0, 0, 0.23) 0px 3px 6px;
}
.navbar a:hover {
color:black;
background: rgb(177, 108, 77);
border-color: black;
}
.container {
width: 100%;
height: 90%;
max-width: 1200px;
display: flex;
justify-content: left;
text-align: left;
align-items: center;
margin: 0 auto;
}
.container .hero-text h1 {
font-size: 3rem;
margin-bottom: 0.3rem;
}
.container .hero-text h2 {
font-size: 1.5rem;
margin-bottom: 0.5rem;
}
.container .hero-text p {
font-family: 'PT Sans';
font-size: 1.2rem;
max-width: 70%;
margin: 0 auto;
margin-left: 0;
}
.container .hero-text a {
font-size: 1.4rem;
font-weight: bold;
text-decoration: none;
color: black;
background-color: lightgray;
display: inline-block;
border: 2px solid;
border-radius: 10px;
padding: 0.5em 1.2em;
margin-top: 1rem;
transition: 0.3s;
box-shadow: rgba(0, 0, 0, 0.16) 0px 3px 6px, rgba(0, 0, 0, 0.23) 0px 3px 6px;
}
.container .hero-text a:hover {
background: rgb(177, 108, 77);
color: black;
}
.container .bilde-credit p {
opacity: 30%;
color: brown;
font-size: 1.0rem;
margin-top: 0.5rem;
}
#media only screen and (max-width: 768px) {
html {
font-size: 10px;
}
}
/*topical siden*/
p{
font-size: small;
}
.container #text {
margin-top: 20px;
}
h1{
float: right;
}
.footer{
left: 0;
bottom: 0;
width: 100%;
background-color: #000d1a;
color: white;
text-align: center;
}
.topical{
width: 100%;
height: 100vh;
background: linear-gradient(rgba(0, 0, 0, 0.350),rgba(0, 0, 0, 0.350)), url('/bilder/topical.jpg') no-repeat center / cover ;
color: white;
}
.teknologi{ /*class laget for å justere på bildet*/
float: right;
margin-right: 20%;
}
.footer a {
color: white; /*gir hyperlenkene i footeren en hvit farge framfor blå, for å skape en god kontrast*/
}
.science {
float: right;
margin-right: 20%;
}
`I am struggling to fit my webpage to all screens. When I inspect the page everything just goes over each other, the text, pictures, the footer, etc. I will glady appreciate if someone can check over my code.
This is my HTML code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Topical siden</title>
<link rel="stylesheet" href="style.css">
<!--Link som referer siden til stylesheet-->
</head>
<body class="topical">
<!-- NAVBAR -->
<div class="navbar">
<nav>
Hjem
Kafé
Booking
Accessibility
</nav>
</div>
<h1>Topical page - Technology and society </h1>
<!--Tittel-->
<div class="container">
<div id="text">
<h2>The interplay between technology and society</h2>
<!--Undertittel-->
<p>
<!--Paragraf-->
1.2 <img src="/bilder/workplace.png" alt="Bilde av samfunn og teknologi" width="300" height="241" class="teknologi"> <!--BILDE, STØRRELSE + CLASS DEFINERT FOR BILDE FOR Å BRUKE I CSS. HENTET FRA https://blog.vantagecircle.com/technology-in-the-workplace/ -->
The evolution of technology is a fundamental part of society, and it is safe to say that we have benefited from it. In the past we relied on books, but now we have phones that can quickly find answers to our questions. Our workplace has also become safer and more efficient with the introduction of automated technology (Ellingrud, 2018), but it has also contributed to the elimination of certain jobs. However, a study of census conducted over the course of 140 years suggests technology has created more jobs than it has destroyed (Stewart et al., 2015, p. 3). It has also helped maintain jobs through difficult times. Thanks to the communication channels technology provides, jobs could still be done from home during the COVID-19 pandemic. In the same way society progresses, it also starts valuing new things: and what becomes important to us, becomes important to technology. One example being that once we realized the effects of climate change, we started caring about creating sustainable technologies.
Societal values can also have a negative impact. Society has long been obsessed with “the perfect body”, and since it is widely advertised, it has inevitably migrated to the internet and become a part of that world. Now we not only see it in the “real” world, but also on our phones constantly. One could argue that its increased exposure intensifies the pressure of fulfilling the unrealistic body standards our society glorifies, which can lead to body image issues and eating disorders.
<br>
<br> <!--IKKE BRUK BR TAG FOR Å LAGE ROM I AVSNITTENE -->
<p>
<img src="/bilder/science.jpeg" alt="Bilde av diverse ting samfunnet og teknologi " width="250" height="241" class="science"> <!--BILDE, STØRRELSE + CLASS DEFINERT FOR BILDE FOR Å BRUKE I CSS. HENTET FRA https://community.thriveglobal.com/the-relationship-between-science-technology-and-society/ -->
1.4
Taking responsibility and attempting to foresee the possible future outcomes of your creation should be an important part of every innovator’s process. Innovations can have serious societal implications and for that reason it is only fair to expect innovators to take this into consideration. However, we should be somewhat reasonable to which degree we hold them accountable, and that is because RRI is not an easy process. It requires research, cooperation and communication – not just in the form of discussion between innovators, but also in the shape of feedback from society. Society plays a significant role in the development of innovations, as the citizens can bring a unique, diversified perspective that innovators could forget to consider. If we fail to properly communicate our criticisms, we are, arguably, partially responsible.
Even a well-intended innovation that had RRI strongly implemented into its process, can be turned “evil”. Technology is not inherently bad/harmful in itself – it is what we choose to do with it that can make it such. Sadly, there are people who take advantage of innovator’s inventions and “villainize” them in ways they weren’t meant to be utilized. Examples of this include the internet: the internet is good because it provides methods of communication and supplies information, but it has also become a damaging place used for other purposes like cyber-bullying and human trafficking recruitment. With a quick Google search, we can see that laws have been set in place to prevent this, and that there can be severe penalties for committing these offenses. However, I would argue that these crimes are hard to regulate because of the anonymity the internet offers us, and because it is not taken as seriously as other “real life” crimes.
No invention will ever be flawless, and unintended consequences will likely surface regardless – but by practicing RRI we can reduce the severity and number of them.
</p>
</p>
</div>
</div>
<!-- FOOTER UNDER + KILDER -->
<div class="footer">
<footer>
Sources: <br>
Ellingrud, K. (2018). The Upside Of Automation: New Jobs, Increased Productivity And Changing Roles For Workers. Retrieved from https://www.forbes.com/sites/kweilinellingrud/2018/10/23/the-upside-of-automation-new-jobs-increased-productivity-and-changing-roles-for-workers/?sh=5237c0d47df0
<br> Stewart, I., De, D. & Cole, A. (2015). Technology and people: The great job-creating machine. 1-16. Retrieved from https://www2.deloitte.com/content/dam/Deloitte/uk/Documents/finance/deloitte-uk-technology-and-people.pdf>
</footer>
</div>
</body>
</html>
I have tried to use % instead of px and vh but the problem still won't be solved.
I have a few questions:
How can I make the image below not interfere with the navigation bar? I've tried various height adjustments and it doesn't move.
How can I make the text read as a paragraph aligned to the right and the image lower and to the left- in other words the paragraph and image parallel to each other. Would this include JavaScript?
I also need help with the alignment of the H1.
I have only used CSS and HTML so far- I've researched everywhere and can't find my solutions. What makes it hard is I know what I want but don't know the terms used to find the solutions. Any help is appreciated! Here is my CSS code:
body{
background-color: #2F3A3B;
text-align: justify;
width: 800px;
text-decoration: none;
color: white;
font-family:'Oswald', sans-serif;
}
ul {
display: inline-block;
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
position: fixed;
top: 0;
width: 100%;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover{
background-color: #111;
}
h1{
text-align: relative;
}
.circular--portrait {
position: relative;
width: 200px;
height: 200px;
overflow: hidden;
border-radius: 50%;
}
.circular--portrait img {
width: 100%;
}
p{
position:relative;
left: 200px;
top: 40px;
}
HTML Code:
<!DOCTYPE html>
<html>
<head>
<title>About Eddie Munoz</title>
<link rel="stylesheet" type="text/css" href="about.css">
</head>
<div class="circular--portrait">
<img src="images/idpic.jpg">
</div>
<body>
<ul>
<li>About</li>
<li>Gallery</li>
<li>Resume</li>
<li>Contact</li>
</ul>
<div class= "column-one">
<p>Eddie Munoz has been creating art from the age of 13. While he was
completing his Bachelors of Applied Science in Human Relations he was
freelancing on the side. Eddie has created numerous character artists.
ljaldjflakjfldjf;lajf;lkjd;</p>
</div>
<div class="column-two">
<h1>What others are saying</h1>
<p>"Eddie is the best young talent I have had the pleasure to work with. He
has a great eye for detail and really finds the fun in whatever project he
is given no matter the size. Eddie strives to learn every nuance of 3D
gaming tech as well as distributing that knowledge once learned. Eddie is an
amazing talent that is bound for superstar status." - Billy Ashlswede, Art
Lead at Riot Games</p>
<p>"Eddie was a highly valued Character Artist with proficiency in many
different modeling programs. He was a very dedicated artist who frequently
helped others and went out of his way to produce additional assets for our
game. Eddie has not only a very technical, but also a very artistic mindset.
All of these qualities make Eddie a great asset to any team." -Kyle Sarvas,
Game Artist/Game Designer</p>
</div>
</body>
</html>
I've made one change to your HTML:
Move circular--portrait just before column-one
And several to your CSS:
Remove text-align: relative; from h1
Remove position: relative; from .circular--portrait
To .circular--portrait set a width of 25% and make it float to left
To p that is descedent of .column-one make float to right and width of 65% (it has to be bellow 75% to float properly)
To column-two make float to left (also works with floating right)
body{
background-color: #2F3A3B;
text-align: justify;
width: 800px;
color: white;
font-family:'Oswald', sans-serif;
}
ul {
display: inline-block;
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
position: fixed;
top: 0;
width: 100%;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover{
background-color: #111;
}
.circular--portrait {
margin-top: 50px;
width: 200px;
height: 200px;
overflow: hidden;
border-radius: 50%;
}
.circular--portrait img {
width: 100%;
}
.circular--portrait {
width: 25%;
float: left;
}
.column-one p{
width: 65%;
float: right;
margin-top: 150px;
margin-left: 10px;
}
.column-two {
float: left;
}
<!DOCTYPE html>
<html>
<head>
<title>About Eddie Munoz</title>
<link rel="stylesheet" type="text/css" href="j.css">
</head>
<body>
<ul>
<li>About</li>
<li>Gallery</li>
<li>Resume</li>
<li>Contact</li>
</ul>
<div class="circular--portrait">
<img src="http://pngimg.com/uploads/face/face_PNG5660.png">
</div>
<div class= "column-one">
<p>Eddie Munoz has been creating art from the age of 13. While he was
completing his Bachelors of Applied Science in Human Relations he was
freelancing on the side. Eddie has created numerous character artists.
ljaldjflakjfldjf;lajf;lkjd;</p>
</div>
<div class="column-two">
<h1>What others are saying</h1>
<p>"Eddie is the best young talent I have had the pleasure to work with. He
has a great eye for detail and really finds the fun in whatever project he
is given no matter the size. Eddie strives to learn every nuance of 3D
gaming tech as well as distributing that knowledge once learned. Eddie is an
amazing talent that is bound for superstar status." - Billy Ashlswede, Art
Lead at Riot Games</p>
<p>"Eddie was a highly valued Character Artist with proficiency in many
different modeling programs. He was a very dedicated artist who frequently
helped others and went out of his way to produce additional assets for our
game. Eddie has not only a very technical, but also a very artistic mindset.
All of these qualities make Eddie a great asset to any team." -Kyle Sarvas,
Game Artist/Game Designer</p>
</div>
</body>
</html>
I am trying to replicate this design http://www.csszengarden.com/217/ for practice purposes.
I've got almost everything right, except that the height of my body is larger than the content it contains.
this is the code
*{
list-style: none;
font-family: 'tablet-gothic-thin', sans-serif;
}*
div {
display: block;
}
html {
padding: 5%;
background-color: #daede2;
}
body {
margin: 0;
padding: 0;
background-color: #77c4d3;
display: block;
}
.page-wrapper {
margin: 0;
padding: 0;
height: auto;
box-sizing: border-box;
position: relative;
z-index: 2;
display: block;
}
.sidebar {
background: rgba(246,247,146,0.9);
position: absolute;
top: 120px;
right: 0px;
width: 30%;
padding: 1%;
z-index: 2;
display: block;
}
.preamble {
background: rgba(255, 255, 255,0.9);
position: relative;
width: 50%;
top: 100px;
left: -70px;
margin: 20px 0;
line-height: 25px;
padding-left: 120px;
padding-top: 40px;
padding-bottom: 40px;
padding-right: 40px;
}
.preamble h3 {
font-size: 40px;
margin-left: 0px;
margin-bottom: 20px;
font-weight: lighter;
}
.preamble p {
margin-top: 0;
padding: 1%;
font-family: sans-serif;
font-size: 17px;
line-height: 25px;
margin: 0.5%;
color: black;
font-weight: lighter;
}
header {
margin: 20px;
}
header h1 {
background-color: #ea2e49;
padding: 15px 15px;
text-align: center;
text-transform: uppercase;
width: 280.05px;
position: relative;
top: 50px;
left: 30px;
font-size: 30px;
font-family: 'tablet-gothic', sans-serif;
font-style: normal;
font-weight: 200;
color: white;
}
header h2 {
font-family: 'Coda Caption', sans-serif;
color: white;
letter-spacing: -7px;
font-size: 110px;
width: 700px;
line-height: 1;
position: relative;
top: 0px;
left: 30px;
}
.summary {
width: 50%;
position: relative;
}
.summary p {
position: relative;
left: 60px;
letter-spacing: 2px;
text-transform: uppercase;
color: white;
font-family: 'tablet-gothic', sans-serif;
font-size: 18px;
}
.summary p:last-child {
border-top: 1px solid #ea2e49;
margin-top: 20px;
padding-top: 25px;
}
.summary p:last-child a {
}
a {
text-decoration: none;
color: white;
border-bottom: 1px solid rgba(0,0,0,0.2);
transition: border-color 0.2s ease-in-out;
}
a:hover {
border-bottom: 1px solid #ea2e49;
}
.select {
font-size: 40px;
font-weight: lighter;
margin-top: 50px;
margin-left: 33px;
margin-bottom: 10px;
text-align: inherit;
}
.design-selection ul {
text-align: inherit;
margin-top: 5px;
margin-left: -5px;
padding-right: 30px;
}
.design-selection li {
font-size: 17px;
line-height: 35px;
color: rgba(0,0,0,0.2);
}
.design-selection li a {
color: black;
}
.archives {
font-size: 40px;
font-weight: lighter;
margin-top: 80px;
margin-left: 33px;
margin-bottom: 10px;
text-align: inherit;
}
.design-archives ul {
text-align: inherit;
margin-top: 5px;
margin-left: -5px;
padding-right: 30px;
}
.design-archives li {
font-size: 17px;
line-height: 35px;
color: rgba(0,0,0,0.2);
}
.design-archives li a {
color: black;
}
.resources {
font-size: 40px;
font-weight: lighter;
margin-top: 80px;
margin-left: 33px;
margin-bottom: 10px;
text-align: inherit;
}
.zen-resources ul {
text-align: inherit;
margin-top: 5px;
margin-left: -5px;
padding-right: 30px;
margin-bottom: 50px;
}
.zen-resources li {
font-size: 17px;
line-height: 35px;
color: rgba(0,0,0,0.2);
}
.zen-resources li a {
color: black;
}
.extra1 {
position: fixed;
z-index: 1;
width: 30%;
top: 0;
right: 0;
bottom: 0;
background-color: rgba(51,55,69,0.9);
}
.main-supporting {
display: block;
position: relative;
padding: 1%;
}
.explanation {
display: block;
position: relative;
top: 253px;
left: 80px;
width: 39%;
padding: 1%;
}
.explanation h3 {
font-family: sans-serif;
font-weight: lighter;
color: white;
margin-left: 5px;
font-size: 30px;
}
.explanation p {
padding: 1%;
font-family: sans-serif;
font-size: 17px;
line-height: 25px;
margin: 0.5%;
color: white;
font-weight: lighter;
}
.participation {
display: block;
position: relative;
top: -265px;
left: 600px;
width: 35%;
padding: 5%;
background: rgba(234,46,73,0.9);
z-index: 3;
}
.participation p {
margin-top: 0;
padding: 1%;
color: white;
line-height: 25px;
font-family: sans-serif;
font-size: 17px;
}
.participation a:hover {
border-bottom: 1px solid white;
}
.participation h3 {
font-family: sans-serif;
font-size: 30px;
color: white;
margin left: 20px;
margin-bottom: 10px;
font-weight: lighter;
}
.benefits {
display: block;
position: relative;
width: 15%;
background: rgba(255,255,255,0.9);
padding: 5%;
top: -150px;
left: 78px;
}
.benefits p {
font-family: sans-serif;
line-height: 25px;
font-weight: lighter;
font-size: 17px;
}
.benefits h3 {
font-family: sans-serif;
font-size: 25px;
font-weight: lighter;
}
.requirements {
display: block;
background: rgba(255,255,255,0.9);
width: 59%;
position: relative;
top: -833px;
left: 381px;
padding: 2%;
}
.requirements p {
font-family: sans-serif;
line-height: 25px;
font-size: 17px;
}
.requirements p:first-child {
margin: 50px 50px 20px 50px;
}
.requirements p:nth-child(2) {
margin: 0px 50px 20px 50px;
}
.requirements p:nth-child(3) {
margin: 0px 50px 20px 50px;
}
.requirements p:nth-child(4) {
margin: 0px 50px 20px 50px;
}
.requirements p:nth-child(5) {
margin: 0px 50px 20px 50px;
padding-bottom: 3%;
}
.requirements p:nth-child(6) {
margin: 0px 50px 40px 50px;
padding-top: 5%;
border-top: 1px solid #ea2e49;
text-transform: uppercase;
}
.requirements h3 {
margin: 50px 50px 10px 50px;
font-family: sans-serif;
font-size: 25px;
font-weight: lighter;
}
.requirements a {
color: black;
}
footer {
position: relative;
display: block;
top: -834.5px;
left: 60px;
background: rgba(246,247,146,0.9);
width: 45%;
padding: 1.5%;
margin-bottom: 0px;
}
footer a {
color: black;
margin-left: 3%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSS Zen Garden: The Beauty of CSS Design</title>
<link rel="stylesheet" media="screen" href="style.css?v=8may2013">
<link rel="stylesheet" type="text/css" href="design.css">
<link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.csszengarden.com/zengarden.xml">
<link href="https://fonts.googleapis.com/css?family=Coda+Caption:800" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Dave Shea">
<meta name="description" content="A demonstration of what can be accomplished visually through CSS-based design.">
<meta name="robots" content="all">
<!--[if lt IE 9]>
<script src="script/html5shiv.js"></script>
<![endif]-->
</head>
<!--
View source is a feature, not a bug. Thanks for your curiosity and
interest in participating!
Here are the submission guidelines for the new and improved csszengarden.com:
- CSS3? Of course! Prefix for ALL browsers where necessary.
- go responsive; test your layout at multiple screen sizes.
- your browser testing baseline: IE9+, recent Chrome/Firefox/Safari, and iOS/Android
- Graceful degradation is acceptable, and in fact highly encouraged.
- use classes for styling. Don't use ids.
- web fonts are cool, just make sure you have a license to share the files. Hosted
services that are applied via the CSS file (ie. Google Fonts) will work fine, but
most that require custom HTML won't. TypeKit is supported, see the readme on this
page for usage instructions: https://github.com/mezzoblue/csszengarden.com/
And a few tips on building your CSS file:
- use :first-child, :last-child and :nth-child to get at non-classed elements
- use ::before and ::after to create pseudo-elements for extra styling
- use multiple background images to apply as many as you need to any element
- use the Kellum Method for image replacement, if still needed.
- don't rely on the extra divs at the bottom. Use ::before and ::after instead.
-->
<body id="css-zen-garden">
<div class="page-wrapper">
<section class="intro" id="zen-intro">
<header role="banner">
<h1>CSS Zen Garden</h1>
<h2>The Beauty of <abbr title="Cascading Style Sheets">CSS</abbr> Design</h2>
</header>
<div class="summary" id="zen-summary" role="article">
<p>A demonstration of what can be accomplished through <abbr title="Cascading Style Sheets">CSS</abbr>-based design. Select any style sheet from the list to load it into this page.</p>
<p>Download the example html file and css file</p>
</div>
<div class="preamble" id="zen-preamble" role="article">
<h3>The Road to Enlightenment</h3>
<p>Littering a dark and dreary road lay the past relics of browser-specific tags, incompatible <abbr title="Document Object Model">DOM</abbr>s, broken <abbr title="Cascading Style Sheets">CSS</abbr> support, and abandoned browsers.</p>
<p>We must clear the mind of the past. Web enlightenment has been achieved thanks to the tireless efforts of folk like the <abbr title="World Wide Web Consortium">W3C</abbr>, <abbr title="Web Standards Project">WaSP</abbr>, and the major browser creators.</p>
<p>The CSS Zen Garden invites you to relax and meditate on the important lessons of the masters. Begin to see with clarity. Learn to use the time-honored techniques in new and invigorating fashion. Become one with the web.</p>
</div>
</section>
<div class="main supporting" id="zen-supporting" role="main">
<div class="explanation" id="zen-explanation" role="article">
<h3>So What is This About?</h3>
<p>There is a continuing need to show the power of <abbr title="Cascading Style Sheets">CSS</abbr>. The Zen Garden aims to excite, inspire, and encourage participation. To begin, view some of the existing designs in the list. Clicking on any one will load the style sheet into this very page. The <abbr title="HyperText Markup Language">HTML</abbr> remains the same, the only thing that has changed is the external <abbr title="Cascading Style Sheets">CSS</abbr> file. Yes, really.</p>
<p><abbr title="Cascading Style Sheets">CSS</abbr> allows complete and total control over the style of a hypertext document. The only way this can be illustrated in a way that gets people excited is by demonstrating what it can truly be, once the reins are placed in the hands of those able to create beauty from structure. Designers and coders alike have contributed to the beauty of the web; we can always push it further.</p>
</div>
<div class="participation" id="zen-participation" role="article">
<h3>Participation</h3>
<p>Strong visual design has always been our focus. You are modifying this page, so strong <abbr title="Cascading Style Sheets">CSS</abbr> skills are necessary too, but the example files are commented well enough that even <abbr title="Cascading Style Sheets">CSS</abbr> novices can use them as starting points. Please see the <abbr title="Cascading Style Sheets">CSS</abbr> Resource Guide for advanced tutorials and tips on working with <abbr title="Cascading Style Sheets">CSS</abbr>.</p>
<p>You may modify the style sheet in any way you wish, but not the <abbr title="HyperText Markup Language">HTML</abbr>. This may seem daunting at first if you’ve never worked this way before, but follow the listed links to learn more, and use the sample files as a guide.</p>
<p>Download the sample HTML and CSS to work on a copy locally. Once you have completed your masterpiece (and please, don’t submit half-finished work) upload your <abbr title="Cascading Style Sheets">CSS</abbr> file to a web server under your control. Send us a link to an archive of that file and all associated assets, and if we choose to use it we will download it and place it on our server.</p>
</div>
<div class="benefits" id="zen-benefits" role="article">
<h3>Benefits</h3>
<p>Why participate? For recognition, inspiration, and a resource we can all refer to showing people how amazing <abbr title="Cascading Style Sheets">CSS</abbr> really can be. This site serves as equal parts inspiration for those working on the web today, learning tool for those who will be tomorrow, and gallery of future techniques we can all look forward to.</p>
</div>
<div class="requirements" id="zen-requirements" role="article">
<h3>Requirements</h3>
<p>Where possible, we would like to see mostly <abbr title="Cascading Style Sheets, levels 1 and 2">CSS 1 & 2</abbr> usage. <abbr title="Cascading Style Sheets, levels 3 and 4">CSS 3 & 4</abbr> should be limited to widely-supported elements only, or strong fallbacks should be provided. The CSS Zen Garden is about functional, practical <abbr title="Cascading Style Sheets">CSS</abbr> and not the latest bleeding-edge tricks viewable by 2% of the browsing public. The only real requirement we have is that your <abbr title="Cascading Style Sheets">CSS</abbr> validates.</p>
<p>Luckily, designing this way shows how well various browsers have implemented <abbr title="Cascading Style Sheets">CSS</abbr> by now. When sticking to the guidelines you should see fairly consistent results across most modern browsers. Due to the sheer number of user agents on the web these days — especially when you factor in mobile — pixel-perfect layouts may not be possible across every platform. That’s okay, but do test in as many as you can. Your design should work in at least IE9+ and the latest Chrome, Firefox, iOS and Android browsers (run by over 90% of the population).</p>
<p>We ask that you submit original artwork. Please respect copyright laws. Please keep objectionable material to a minimum, and try to incorporate unique and interesting visual themes to your work. We’re well past the point of needing another garden-related design.</p>
<p>This is a learning exercise as well as a demonstration. You retain full copyright on your graphics (with limited exceptions, see submission guidelines), but we ask you release your <abbr title="Cascading Style Sheets">CSS</abbr> under a Creative Commons license identical to the one on this site so that others may learn from your work.</p>
<p role="contentinfo">By Dave Shea. Bandwidth graciously donated by mediatemple. Now available: Zen Garden, the book.</p>
</div>
<footer>
HTML
CSS
CC
A11y
GH
</footer>
</div>
<aside class="sidebar" role="complementary">
<div class="wrapper">
<div class="design-selection" id="design-selection">
<h3 class="select">Select a Design:</h3>
<nav role="navigation">
<ul>
<li>
Mid Century Modern by Andrew Lohman
</li> <li>
Garments by Dan Mall
</li> <li>
Steel by Steffen Knoeller
</li> <li>
Apothecary by Trent Walton
</li> <li>
Screen Filler by Elliot Jay Stocks
</li> <li>
Fountain Kiss by Jeremy Carlson
</li> <li>
A Robot Named Jimmy by meltmedia
</li> <li>
Verde Moderna by Dave Shea
</li> </ul>
</nav>
</div>
<div class="design-archives" id="design-archives">
<h3 class="archives">Archives:</h3>
<nav role="navigation">
<ul>
<li class="next">
<a href="/214/page1">
Next Designs <span class="indicator">›</span>
</a>
</li>
<li class="viewall">
<a href="http://www.mezzoblue.com/zengarden/alldesigns/" title="View every submission to the Zen Garden.">
View All Designs </a>
</li>
</ul>
</nav>
</div>
<div class="zen-resources" id="zen-resources">
<h3 class="resources">Resources:</h3>
<ul>
<li class="view-css">
<a href="style.css" title="View the source CSS file of the currently-viewed design.">
View This Design’s <abbr title="Cascading Style Sheets">CSS</abbr> </a>
</li>
<li class="css-resources">
<a href="http://www.mezzoblue.com/zengarden/resources/" title="Links to great sites with information on using CSS.">
<abbr title="Cascading Style Sheets">CSS</abbr> Resources </a>
</li>
<li class="zen-faq">
<a href="http://www.mezzoblue.com/zengarden/faq/" title="A list of Frequently Asked Questions about the Zen Garden.">
<abbr title="Frequently Asked Questions">FAQ</abbr> </a>
</li>
<li class="zen-submit">
<a href="http://www.mezzoblue.com/zengarden/submit/" title="Send in your own CSS file.">
Submit a Design </a>
</li>
<li class="zen-translations">
<a href="http://www.mezzoblue.com/zengarden/translations/" title="View translated versions of this page.">
Translations </a>
</li>
</ul>
</div>
</div>
</aside>
</div>
<!--
These superfluous divs/spans were originally provided as catch-alls to add extra imagery.
These days we have full ::before and ::after support, favour using those instead.
These only remain for historical design compatibility. They might go away one day.
-->
<div class="extra1" role="presentation"></div><div class="extra2" role="presentation"></div><div class="extra3" role="presentation"></div>
<div class="extra4" role="presentation"></div><div class="extra5" role="presentation"></div><div class="extra6" role="presentation"></div>
</body>
</html>
As you can see in the code snippet, there is extra space after the contents.
I need help with this.
Thank You.
There are postives and negatives when using relative position in this layout..
Look at the shot below
your div with id zen-requirements has been relative positioned in the layout and there is top: -833px;. take out this top and you will notice that the initial position of the div takes up that space you are trying to get rid of (not forgetting a little bit of padding somewhere).....
hmmmm....Sticking to this layout..I believe you will have to adjust the size of your div that has class page-wrapper (add an id to avoid other classes being affected)
Add these rules to id..
height: 3000px;
overflow:hidden
A Javascript approach to find computed position of last yellow footer relative to window top and auto adjust the window size might work...
I think it's because of the relative positioning of .requirements block.
See: position:relative leaves an empty space
If you add a fixed size to your container, it can fix the issue, but in general your design is different from the sample you shown. Try this:
#zen-supporting {
height: 1750px;
}
html{ padding: 5%} is the reason. It makes extra space in the bottom too.
You can set it as: html{padding: 5% 5% 0 5%}
Edit
If you, also, mean the extra space in blue color under the navigation contains, HTML, CSS, ... you may also adjust the padding of div.main:
div.main {
padding: 5% 5% 0 5%;
}
to be like the following screen shot:
I am designing a website using HTML and CSS and there appears to be an invisible margin somewhere.
Currently, my website looks like this:
h1, h2 {
font-family: 'Righteous', cursive;
text-align: center;
}
body {
font-family: 'Roboto', sans-serif;
color: black;
border: 5px solid #375E97;
}
article, aside {
padding: 1%;
margin: 1.5% 0;
border: 5px solid #375E97;
border-left: 0;
display: inline-block;
vertical-align: top;
}
article {
width: 60%;
}
aside {
width: 30%;
background-image: url("money-stack.png");
background-size: cover;
background-position: 200px 200px;
}
h1 {
background-color: #375E97;
color: #FFFFFF;
font-size: 6.9vw;
text-transform: uppercase;
padding: 0;
margin: 0 auto 2.1% auto;
line-height: 4.9vw;
height: 5vw;
}
h2 {
color: #375E97;
font-size: 3.5vw;
padding: 0;
margin: 0;
}
p {
padding: 0;
margin: 1% 0 0 0;
font-size: 1vw;
}
.sub-heading {
font-style: italic;
text-align: center;
}
.sub-heading > span {
font-weight: 700;
font-style: normal;
}
<!DOCTYPE html>
<html>
<head>
<title>Act 1</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Righteous|Roboto:400,700,400i" rel="stylesheet">
</head>
<body>
<header>
<h1>Filler text here</h1>
</header>
<article>
<h2>More more</h2>
<p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts.</p>
<p>Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean.</p>
<p>A small river named Duden flows by their place and supplies it with the necessary regelialia.</p>
<p>It is a paradisematic country, in which roasted parts of sentences fly into your mouth.</p>
<p>Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar.</p>
</article>
<aside>
<h2>And More</h2>
<p>
<div class="sub-heading">
<p>She packed her seven versalia, put her initial into the belt and made herself on the way.</p>
</div>
<br>
<p>The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didn’t listen.</p>
</p>
</aside>
</body>
</html>
If you look closely at the article and aside in the middle of the screenshot, you can see that I have made their display: inline-block; and removed the border from the left of the aside (smaller one).
The Problem
The problem is that I want to actually "pin" the aside to the right of the body, not the article. I know that to make this work I would have to remove the border from the right and add it to the left.
What I Have Tried
Playing around with various values for align, text-align and all the other aligns you can think of.
Making the aside and article have no tags in between them.
Please note, I have seen other solutions for this, but I want a clean solution that makes sense.
This is what you were trying to achieve I guess.
article and aside are now floated left and right.
This is actually the solution from kukkuz in the comments. I don't know why it shouldn't work for you.
A clearfix is used instead of an additional element with clear: both
Without the surrounding element, body in this case, doesn't get the height from its content and the border around everything wouldn't display correctly.
h1, h2 {
font-family: 'Righteous', cursive;
text-align: center;
}
body {
font-family: 'Roboto', sans-serif;
color: black;
border: 5px solid #375E97;
}
body:after {
content: '';
clear: both;
display: table;
}
article, aside {
padding: 1%;
margin: 1.5% 0;
border: 5px solid #375E97;
border-left: 0;
}
article {
width: 60%;
float: left;
}
aside {
width: 30%;
border-left: 5px solid #375E97;
border-right: 0;
float: right;
background-image: url("money-stack.png");
background-size: cover;
background-position: 200px 200px;
}
h1 {
background-color: #375E97;
color: #FFFFFF;
font-size: 6.9vw;
text-transform: uppercase;
padding: 0;
margin: 0 auto 2.1% auto;
line-height: 4.9vw;
height: 5vw;
}
h2 {
color: #375E97;
font-size: 3.5vw;
padding: 0;
margin: 0;
}
p {
padding: 0;
margin: 1% 0 0 0;
font-size: 1vw;
}
.sub-heading {
font-style: italic;
text-align: center;
}
.sub-heading > span {
font-weight: 700;
font-style: normal;
}
<!DOCTYPE html>
<html>
<head>
<title>Act 1</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Righteous|Roboto:400,700,400i" rel="stylesheet">
</head>
<body>
<header>
<h1>Filler text here</h1>
</header>
<article>
<h2>More more</h2>
<p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts.</p>
<p>Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean.</p>
<p>A small river named Duden flows by their place and supplies it with the necessary regelialia.</p>
<p>It is a paradisematic country, in which roasted parts of sentences fly into your mouth.</p>
<p>Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar.</p>
</article>
<aside>
<h2>And More</h2>
<p>
<div class="sub-heading">
<p>She packed her seven versalia, put her initial into the belt and made herself on the way.</p>
</div>
<br>
<p>The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didn’t listen.</p>
</p>
</aside>
</body>
</html>
I hope I understood your issue. There's many ways you could achieve this, the most obvious one would be to remove your inline rule and make both aside and article float: right; and float: left; respectively, but float was intended to make text float around images and not exactly to position divs (eventhough it works). As so, what I would try is to position: absolute; both the aside and article; and use left, right, top, bottom to position elements.
article {
position: absolute;
top: 69px;
width: 60%;
}
aside {
background-image: url("money-stack.png");
background-position: 200px 200px;
background-size: cover;
position: absolute;
right: 8px;
top: 69px;
width: 30%;
}
body {
border: 5px solid #375e97;
color: black;
font-family: "Roboto",sans-serif;
min-height: 318px;
}
After, you can either set a minimum size for the container, or add a clear:both; styled element to the bottom in order to make the container stretch to the correct size.
One other thing I think you should change is the fact that you're using body as your container and applying styles to it. I think it's good practice to create an actual container div, and apply styles to that instead.
I'm just learning/practicing, so any help would be SUPER appreciated. Also, if you find other errors or inefficiencies while looking, I'd love to hear about it.
I have four layers.
.body
.main
.main-side
.sidebar
This is essentially what I'm trying to recreate , and everything is working fine other than the third layer, or in the case of the example, the navy blue bar extending vertical on the right side. I can get it to go to the second layer (right above the main background) or cover up everything (including the sidebar), but I can't get it between layer two and four (in the example, the light blue inner box and the smaller, yellow side box.) Thanks in advance!
Here is the HTML and the CSS.
<!doctype html>
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,900' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="./style.css"/>
<title>CSS Zen Garden</title>
<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<div class="main-side"></div>
<div class="main">
<h1 class="redbox">CSS Zen Garden</h1>
<h2>The Beauty of CSS Design</h2>
<div class="sub-heading">
<p class="top>">A demonstration of what can be accomplished through CSS-based design. Select any style sheet from the list to load it into this page.</p>
<hr>
<p class="bottom">Download the example HTML file and CSS file
</div>
<div class="enlightenment">
<h3>The Road to Enlightenment</h3>
<p>Littering a dark and dreary road lay the past relics of browser-specific tags, incompatible DOMs, broken CSS support, and abandoned browsers</p>
<p>We must clear the mind of the past. Web enlightenment has been achieved thanks to the tireless efforts of folk like the W3C, WaSP, and the major browser creators.</p>
<p>The CSS Zen Garden invites you to relax and meditate on the important lessons of the masters. Begin to see with clarity. Learn to use the time-honored techniques in new and invigorating fashion. Become one with the web.</p>
</div>
<div class="about">
<h3>So What is This About?</h3>
<p>There is a continuing need to show the power of CSS. The Zen Garden aims to excite, inspire, and encourage participation. To begin, view some of the existing designs in the list. Clicking on any one will load the style sheet into this very page. The HTML remains the same, the only thing that has changed is the external CSS file. Yes, really.</p>
<p>CSS allows complete and total control over the style of a hypertext document. The only way this can be illustrated in a way that gets people excited is by demonstrating what it can truly be, once the reins are placed in the hands of those able to create beauty from structure. Designers and coders alike have contributed to the beauty of the web; we can always push it further.</p>
</div>
<div class="participation">
<h3>Participation</h3>
<p>Strong visual design has always been our focus. You are modifying this page, so strong CSS skills are necessary too, but the example files are commented well enough that even CSS novices can use them as starting points. Please see the CSS Resource Guide for advanced tutorials and tips on working with CSS.</p>
<p>You may modify the style sheet in any way you wish, but not the HTML. This may seem daunting at first if you’ve never worked this way before, but follow the listed links to learn more, and use the sample files as a guide.</p>
<p>Download the sample HTML and CSS to work on a copy locally. Once you have completed your masterpiece (and please, don’t submit half-finished work) upload your CSS file to a web server under your control. Send us a link to an archive of that file and all associated assets, and if we choose to use it we will download it and place it on our server.</p>
</div>
<div class="benefits">
<h3>Benefits</h3>
<p>Why participate? For recognition, inspiration, and a resource we can all refer to showing people how amazing CSS really can be. This site serves as equal parts inspiration for those working on the web today, learning tool for those who will be tomorrow, and gallery of future techniques we can all look forward to.</p>
</div>
<div class="sidebar">
<h3>Select a Design:</h3>
<ul>
<li>
Mid Century Modern by Andrew Lohman
</li>
<li>
Garments by Dan Mall
</li>
<li>
Steel by Steffen Knoeller
</li>
<li>
Apothecary by Trent Walton
</li>
<li>
Screen Filler by Elliot Jay Stocks
</li>
<li>
Fountain Kiss by Jeremy Carlson
</li>
<li>
A Robot Named Jimmy by meltmedia
</li>
<li>
Verde Moderna by Dave Shea
</li>
</ul>
<h3>Archives:</h3>
<ul>
<li>
Next Designs <span class="indicator">›</span>
</li>
<li>
View All Designs
</li>
</ul>
<h3>Resources:</h3>
<ul>
<li>
View This Design’s CSS
</li>
<li>
CSS Resources
</li>
<li>
FAQ
</li>
<li>
<a href="http://www.mezzoblue.com/zengarden/submit/" title="Send in your own CSS file.">
Submit a Design</a>
</li>
<li>
Translations
</li>
</ul>
</div>
<div class="requirements">
<h3>Requirements</h3>
<p>Where possible, we would like to see mostly CSS 1 & 2 usage. CSS 3 & 4 should be limited to widely-supported elements only, or strong fallbacks should be provided. The CSS Zen Garden is about functional, practical CSS and not the latest bleeding-edge tricks viewable by 2% of the browsing public. The only real requirement we have is that your CSS validates.</p>
<p>Luckily, designing this way shows how well various browsers have implemented CSS by now. When sticking to the guidelines you should see fairly consistent results across most modern browsers. Due to the sheer number of user agents on the web these days — especially when you factor in mobile — pixel-perfect layouts may not be possible across every platform. That’s okay, but do test in as many as you can. Your design should work in at least IE9+ and the latest Chrome, Firefox, iOS and Android browsers (run by over 90% of the population).</p>
<p>We ask that you submit original artwork. Please respect copyright laws. Please keep objectionable material to a minimum, and try to incorporate unique and interesting visual themes to your work. We’re well past the point of needing another garden-related design.</p>
<p>This is a learning exercise as well as a demonstration. You retain full copyright on your graphics (with limited exceptions, see submission guidelines), but we ask you release your CSS under a Creative Commons license identical to the one on this site so that others may learn from your work.</p>
<hr>
<div class="author">
<p>By Dave Shea. Bandwidth graciously donated by mediatemple. Now available: Zen Garden, the book.</p>
</author>
</div>
<footer>
HTML
CSS
CC
A11y
GH
</footer>
</div>
</body>
</html>
body {
font-family: 'Source Sans Pro';
line-height: 120%;
font-size: 16px;
font-weight: 400;
color: #333;
background: #daede2;
z-index: 1;
width: 90%;
vertical-align: center;
}
p {
font-size: 20px;
line-height: 140%;
padding-left: 50px;
}
h1 {
font-weight: 300;
text-transform: uppercase;
font-size: 30px;
color: white;
margin-bottom: -25px;
}
h2 {
font-weight: 900;
font-size: 130px;
line-height: 100%;
color: white;
letter-spacing: -.025em;
line-height: 1em;
width: 65%;
margin-left: 50px;
position: relative;
}
.sub-heading {
text-transform: uppercase;
width: 60%;
margin: 0 0 50px 14px;
position: relative;
color: white;
letter-spacing: .07em;
font-size: 18px;
}
h3 {
font-size: 30px;
font-weight: 400;
padding-left: 50px;
}
.main {
background: #77c4d3;
position: relative;
top: 50px;
left: 50px;
z-index: 2;
height: 5000px;
}
.main-side {
background: #3a4453;
position: absolute;
left: 1020px;
height: 2000px;
top: -200px;
width: 30%;
z-index: 1;
}
.redbox {
background: #df3c56;
position: relative;
top: 50px;
left: 50px;
padding: 25px;
width: 224px;
text-align: center;
}
.enlightenment {
background: #f2f9fb;
padding: 50px 50px 50px 0;
width: 58%;
position: relative;
top: 40px;
margin-bottom: 150px;
}
.about {
color: white;
width: 45%;
margin-bottom: 100px;
margin-top: 250px;
}
.about h3 {
color: white;
}
.benefits {
background: #f2f9fb;
position: relative;
top: 225px;
float: left;
padding: 50px;
width: 25%;
left: 50px;
}
.sidebar {
background: #e9f198;
position: absolute;
top: 70px;
right: 0px;
width: 25%;
font-size: 18px;
line-height: 200%;
letter-spacing: -.01em;
padding-right: 40px;
z-index: 4;
}
.sidebar a, h3 {
color: #333;
}
.sidebar h3 {
font-weight: 400;
padding-left: 40px;
margin-bottom: -20px;
}
.sidebar ul {
list-style-type: none;
}
.participation {
background: #df3c56;
float: right;
width: 45%;
color: white;
position: relative;
top: -618px;
right: 80px;
padding-top: 50px;
}
.participation p {
padding: 0 50px 0 50px;
}
.participation h3 {
color: white;
}
.requirements {
background: #f2f9fb;
position: relative;
float: right;
top: -625px;
width: 57%;
padding: 50px;
}
.requirements a {
color: #333;
text-transform: uppercase;
}
.author {
text-transform: uppercase;
}
footer {
background: #e9f198;
position: relative;
top: 119px;
padding: 25px;
font-size: 22px;
word-spacing: 10px;
color: #333;
left: -440px;
width: 80%;
}
a {
text-decoration: none;
color: white;
border-bottom: solid 1px #999;
padding-bottom: 2px;
}
hr {
border: 0;
height: 0;
border-top: 1px solid #df3c56;
width: 93%;
margin: 50px 0 50px 50px;
}
All you need to do is move .main-side into .main so you can add the right z-index to it to make it overlap like the example you posted and adjust the values:
.main-side {
background: rgba(58,68,83, .8); //convert to rgba so you can fade the background like the example
position: absolute;
right: -150px; //update - change to right instead
height: 2400px; //update
top: -200px;
width: 30%;
z-index: 1;
}
I also converted some of your colors to rgba to give it that transparent look.
FIDDLE
I'm not quite sure what you're asking, but here's a few things that might help. First, to achieve what they are with the yellow menu, you should use something like this:
.sidebar {
background: #e9f198;
position: absolute;
top: 70px;
right: -100px;
width: 25%;
font-size: 18px;
line-height: 200%;
letter-spacing: -.01em;
padding-right: 40px;
z-index: 4;
}
You'll see that the sidebar is now placed more like theirs.
And with these two changes, does it get closer to what you're looking for?
.main {
background: #77c4d3;
position: relative;
top: 50px;
left: 50px;
z-index: 2;
height: 5000px;
}
.main-side {
background: #3a4453;
position: absolute;
left: 900px;
height: 2000px;
top: 70px;
width: 30%;
z-index: 1;
}
I've also made a JSFIDDLE, which you should always do in the future for questions like this!