Related
Good evening all,
my name is Erika and I am working on a website.
I have a good understanding of html and css however I got stuck with this problem:
and for this reason I am writing on stackoverflow.
I want to make this tab system work, however I am struggling to understand how I can change the tab when the input radio is :checked.
Here you can find the code and a image of what I am trying of achieve.
I would really appreciate any help.
Thank you very much.
Best reagards
Erika
/* tabs input and label */
.tabs-wrapper {
margin-bottom: 35px;
overflow: hidden;
.tabs {
display: inline-flex;
flex-wrap: wrap;
justify-content: flex-start;
&.tab {
margin-right: 4px;
margin-bottom: 12px;
color: white;
text-align: center;
user-select: none;
&:hover {
cursor: pointer;
}
}
}
}
/* second separate div where the tab-content are */
.product-main-body-wrapper {
.product-body {
width: 100%;
.tab-content {
display: none;
}
}
}
/* make panel tab-content appear */
.tabs-wrapper
.tabs-nav
#tab-1:checked
~ .product-main-body-wrapper
.product-body
#Tab1,
.tabs-wrapper
.tabs-nav
#tab-2:checked
~ .product-main-body-wrapper
.product-body
#Tab2 {
display: block;
}
.radio {
display: none;
}
/* change color of tab label */
#tab-1:checked ~ .tabs #one-tab,
#tab-2:checked ~ .tabs #two-tab {
background: red;
color: white;
}
<div class="tabs-wrapper">
<nav class="tabs-nav">
<input type="radio" class="radio" id="tab-1" name="tab-control" checked>
<input type="radio" class="radio" id="tab-2" name="tab-control">
<div class="tabs">
<label for="tab-1" id="one-tab" class="tab btn-secondary">Tab one</label>
<label for="tab-2" id="two-tab" class="tab btn-secondary">Tab two</label>
</div>
</nav>
</div>
<div class="product-main-body-wrapper">
<div class="product-body">
<div id="Tab1" class="tab-content">
<article>
<p> panel one </p>
</article>
</div>
<div id="Tab2" class="tab-content">
<article> panel two</article>
</div>
</div>
</div>
Have a look at this page.
Code (c) copyright css tricks
<html><head>
<meta charset="UTF-8">
<title>CSS Tabs</title>
<style>
* { margin: 0; padding: 0; }
#page-wrap { width: 960px; margin: 100px auto; }
h1 { font: 36px Georgia, Serif; margin: 20px 0; }
.group:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; }
p { margin: 0 0 10px 0; }
.tabs { list-style: none; }
.tabs li { display: inline; }
.tabs li a { color: black; float: left; display: block; padding: 4px 10px; margin-left: -1px; position: relative; left: 1px; background: white; text-decoration: none; }
.tabs li a:hover { background: #ccc; }
/* Generic styles & example one */
.tabbed-area { margin: 0 0 120px 0; }
.box-wrap { position: relative; min-height: 250px; }
.tabbed-area div div { background: white; padding: 20px; min-height: 250px; position: absolute; top: -1px; left: 0; width: 100%; }
.tabbed-area div div, .tabs li a { border: 1px solid #ccc; }
#box-one:target, #box-two:target, #box-three:target { z-index: 1; }
/* Stuff for example two */
.cur-nav-fix { margin-top: 60px; }
.cur-nav-fix .tabs { position: absolute; bottom: 100%; left: -1px; }
.cur-nav-fix .tabs li a { background: -moz-linear-gradient(top, white, #eee); }
#box-four { z-index: 1; }
#box-four:target .tabs,
#box-five:target .tabs,
#box-six:target .tabs { z-index: 3; }
#box-four:target, #box-five:target, #box-six:target { z-index: 2; }
.cur-nav-fix .tabs li.cur a { border-bottom: 1px solid white; background: white; }
/* Stuff for example three */
.cur-nav-fix-2 .tabs li a { background: -moz-linear-gradient(top, white, #eee); }
.cur-nav-fix-2 .tabs { z-index: 2; position: relative; }
#box-seven:target .box-seven,
#box-eight:target .box-eight,
#box-nine:target .box-nine { z-index: 1; }
#box-seven:target a[href="#box-seven"],
#box-eight:target a[href="#box-eight"],
#box-nine:target a[href="#box-nine"] { border-bottom: 1px solid white; background: white; }
/* Stuff for example four */
.active-test { padding-top: 40px; }
.active-test .single-tab em { background: white; width: 50px; font-style: normal; position: absolute; bottom: 100%; text-decoration: none; color: black; border: 1px solid #ccc; padding: 5px 10px; }
.active-test .single-tab span { position: absolute; top: -1px; left: 0; width: 100%; display: block; padding: 20px; border: 1px solid #ccc; min-height: 250px; background: white; }
.active-test .single-tab:active em { background: #ccc; }
.active-test .single-tab:active span, .active-test .single-tab:focus span { z-index: 1; }
.tab-ten em { left: 0; }
.tab-eleven em { left: 70px; }
.tab-twelve em { left: 140px; }
/* Stuff for example five */
.adjacent { position: relative; margin-top: 50px; min-height: 300px; }
.adjacent div { border: 1px solid #ccc; background: white; padding: 20px; min-height: 250px; position: absolute; top: -1px; left: 0; width: 100%; }
.adjacent .tabs { position: absolute; bottom: 100%; left: 0; z-index: 2; }
.adjacent .tabs li a { background: -moz-linear-gradient(top, white, #eee); }
#box-thirteen:target,
#box-fourteen:target,
#box-fifteen:target { z-index: 1; }
#box-thirteen:target ~ .tabs a[href='#box-thirteen'],
#box-fourteen:target ~ .tabs a[href='#box-fourteen'],
#box-fifteen:target ~ .tabs a[href='#box-fifteen'] { background: white; border-bottom: 1px solid white; }
/* Stuff for example six */
.w3c { min-height: 250px; position: relative; width: 100%; }
.w3c > div { display: inline; }
.w3c > div > a { margin-left: -1px; position: relative; left: 1px; text-decoration: none; color: black; background: white; display: block; float: left; padding: 5px 10px; border: 1px solid #ccc; border-bottom: 1px solid white; }
.w3c > div:not(:target) > a { border-bottom: 0; background: -moz-linear-gradient(top, white, #eee); }
.w3c > div:target > a { background: white; }
.w3c > div > div { background: white; z-index: -2; left: 0; top: 30px; bottom: 0; right: 0; padding: 20px; border: 1px solid #ccc; }
.w3c > div:not(:target) > div { position: absolute }
.w3c > div:target > div { position: absolute; z-index: -1; }
/* Stuff for example seven - including conditionals below */
#ie-test { position: relative; width: 100%; }
#boxLinks { list-style: none; overflow: hidden; }
#boxLinks li { display: inline; }
#boxLinks li a { padding: 5px 10px; color: black; text-decoration: none; border: 1px solid #ccc; float: left; display: block; margin-left: -1px; position: relative; left: 1px; }
#boxLinks li a:hover { color: #fff; background: #000; }
#box { height: 250px; border: 1px solid #ccc; overflow: hidden; padding: 0px 30px 0px 30px; position: relative; top: -1px; }
.box { display: none; height: 250px; overflow: auto; display: block; position: relative; overflow-x: hidden; }
#box1:target, #box2:target, #box3:target { display: block; }
</style>
<!--[if IE]>
<style type="text/css">
.box { display: block; }
#box { overflow: hidden;position: relative; }
b { position: absolute; top: 0px; right: 0px; width:1px; height: 251px; overflow: hidden; text-indent: -9999px; }
</style>
<![endif]-->
</head>
<body>
<div id="demo-top-bar">
<div id="demo-bar-inside">
<h2 id="demo-bar-badge">
CSS-Tricks Example
</h2>
<div id="demo-bar-buttons">
<a class="header-button" href="/5841-css3-tabs/">← Back to Article</a> </div>
</div>
</div>
<div id="page-wrap">
<div style="width: 420px; float: left;">
<h1>Example One</h1>
<p>Grade: C</p>
<p>From an HTML perspective, this is the absolute cleanest. It just doesn't deal with current
navigation highlighting.</p>
<div class="tabbed-area">
<ul class="tabs group">
<li>Tab 1</li>
<li>Tab 2</li>
<li>Tab 3</li>
</ul>
<div class="box-wrap">
<div id="box-one">
<ul>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
<li>Vestibulum auctor dapibus neque.</li>
</ul>
</div>
<div id="box-two">
<p>Feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
</div>
<div id="box-three">
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
</div>
</div>
</div>
<h1>Example Three</h1>
<p>Grade: B</p>
<p>This has current navigation highlighting. The only downside is that it requires as
many wrapping divs as there are panels.</p>
<div id="box-seven"><div id="box-eight"><div id="box-nine">
<div class="tabbed-area cur-nav-fix-2">
<ul class="tabs group">
<li>Tab 7</li>
<li>Tab 8</li>
<li>Tab 9</li>
</ul>
<div class="box-wrap">
<div class="box-seven">
<ul>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
<li>Vestibulum auctor dapibus neque.</li>
</ul>
</div>
<div class="box-eight">
<p>Feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
</div>
<div class="box-nine">
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
</div>
</div>
</div>
</div></div></div>
<h1>Example Five</h1>
<p>Grade: B</p>
<p>This is handles current navigation highlighting, with pretty clean HTML. The only downside is
that the list for the tab navigation comes <em>after</em> the panels.</p>
<div class="tabbed-area adjacent">
<div id="box-thirteen">
<ul>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
<li>Vestibulum auctor dapibus neque.</li>
</ul>
</div>
<div id="box-fourteen">
<p>Feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
</div>
<div id="box-fifteen">
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
</div>
<ul class="tabs group">
<li>Tab 13</li>
<li>Tab 14</li>
<li>Tab 15</li>
</ul>
</div>
<h1>Example Seven</h1>
<p>Grade: Depends</p>
<p>This example is the only one that works in IE 7+, so that's big bonus points.</p>
<div id="ie-test">
<ul id="boxLinks" class="group">
<li>Tab 19</li>
<li>Tab 20</li>
<li>Tab 21</li>
</ul>
<div id="box">
<div id="box1" class="box">
<ul>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
<li>Vestibulum auctor dapibus neque.</li>
</ul>
<!--[if IE]><b>.</b><![endif]-->
</div>
<div id="box2" class="box">Another box! <!--[if IE]><b>.</b><![endif]--></div>
<div id="box3" class="box">Woot! <!--[if IE]><b>.</b><![endif]--></div>
</div>
</div>
</div>
<div style="width: 420px; float: right;">
<h1>Example Two</h1>
<p>Grade: D</p>
<p>This fixes the current navigation problem, but requires the menu to be repeated inside
of each panel, which is pretty unacceptable. The hash-links also jump to the panel themselves,
which cuts off the actual tabs if there is enough page scroll below the panels.</p>
<div class="tabbed-area cur-nav-fix">
<div class="box-wrap">
<div id="box-four">
<ul>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
<li>Vestibulum auctor dapibus neque.</li>
</ul>
<ul class="tabs group">
<li class="cur">Tab 4</li>
<li>Tab 5</li>
<li>Tab 6</li>
</ul>
</div>
<div id="box-five">
<p>Feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
<ul class="tabs group">
<li>Tab 4</li>
<li class="cur">Tab 5</li>
<li>Tab 6</li>
</ul>
</div>
<div id="box-six">
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
<ul class="tabs group">
<li>Tab 4</li>
<li>Tab 5</li>
<li class="cur">Tab 6</li>
</ul>
</div>
</div>
</div>
<h1>Example Four</h1>
<p>Grade: F</p>
<p>This was an attempt at using the :active and :focus states instead of using :target.
This would have made it even IE 6 compatible. It works as you click, but I haven't been
able to get the link to keep it's focus or active state after the click. Plus, all the
content is inside the anchor link which is sketchy at best.</p>
<div class="tabbed-area active-test">
<div class="box-wrap">
<a class="single-tab tab-ten" href="#box-ten">
<em>Tab 10</em>
<span id="box-ten">
<ul>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
<li>Vestibulum auctor dapibus neque.</li>
</ul>
</span>
</a>
<a class="single-tab tab-eleven" href="#box-ten">
<em>Tab 11</em>
<span id="box-eleven">
<p>Feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
</span>
</a>
<a class="single-tab tab-twelve" href="#box-ten">
<em>Tab 12</em>
<span id="box-twelve">
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
</span>
</a>
</div>
</div>
<h1>Example Six</h1>
<p>Grade: A</p>
<p>This is the winner so far. It is infinitely expandable (no selectors specific to panels) and the markup is pretty clean.
Possible issues: cross-browser line height issues possibly not making perfect layout, links are placed right above each
div instead of a in central list at the top.</p>
<div class="w3c">
<div id="tab16">
Tab 16
<div>One might well argue, that...</div>
</div>
<div id="tab17">
Tab 17
<div>... 30 lines of CSS is rather a lot, and...</div>
</div>
<div id="tab18">
Tab 18
<div>... that 2 should have been enough, but...</div>
</div>
</div>
</div>
</div>
<style type="text/css" style="display: none !important;">
* {
margin: 0;
padding: 0;
}
body {
overflow-x: hidden;
}
#demo-top-bar {
text-align: left;
background: #222;
position: relative;
zoom: 1;
width: 100% !important;
z-index: 6000;
padding: 20px 0 20px;
}
#demo-bar-inside {
width: 960px;
margin: 0 auto;
position: relative;
overflow: hidden;
}
#demo-bar-buttons {
padding-top: 10px;
float: right;
}
#demo-bar-buttons a {
font-size: 12px;
margin-left: 20px;
color: white;
margin: 2px 0;
text-decoration: none;
font: 14px "Lucida Grande", Sans-Serif !important;
}
#demo-bar-buttons a:hover,
#demo-bar-buttons a:focus {
text-decoration: underline;
}
#demo-bar-badge {
display: inline-block;
width: 302px;
padding: 0 !important;
margin: 0 !important;
background-color: transparent !important;
}
#demo-bar-badge a {
display: block;
width: 100%;
height: 38px;
border-radius: 0;
bottom: auto;
margin: 0;
background: url(/images/examples-logo.png) no-repeat;
background-size: 100%;
overflow: hidden;
text-indent: -9999px;
}
#demo-bar-badge:before, #demo-bar-badge:after {
display: none !important;
}
</style>
</body></html>
Hi i'm fairly new to HTML/CSS/Javascript, im struggling to reduce the size of my background images within my slider carousel on my webpage. What i'm trying to do is reduce the size of my background image so it sits on top of my login rather than below and then have a black background behind my login.
Please look at my image of webpage > https://imgur.com/NcqqZk1
html body
{
margin:0;
padding:0;
}
body{
height:100%;
background-color:black !important;
}
/*-------------header-----------*/
header
{
height:110px;
line-height: 110px;
position:fixed;
z-index:1;
width:100%;
}
.secondary{
background-color:darkorange;
box-shadow:0px 0px 15px 0px;
transition:all 0.5s ease-in-out;
}
/*-------------nav-----------*/
ul
{
list-style:none;
}
ul li
{
display:inline-block;
}
header nav
{
float: right;
}
.logo img
{
margin-top:-20px;
height:30px;
}
header nav ul li a
{
padding-right: 25px;
font-weight: bold;
color: white;
transition: all 0.5s ease-in;
}
header nav ul li a:hover
{
text-decoration: none;
color:black;
}
/*-------------slider-----------*/
.img1
{
background-image:linear-gradient(rgba(0,0,0,0.6),rgba(0,0,0,0.7)),url(work.jpg);
background-size:100% 100%;
}
.slider,.slider ul,.slider ul li
{
height:100%;
width:100%;
color:white;
text-align: center;
padding:0px;
}
.slider h2
{
font-weight: bold;
margin-top:260px;
}
.slider span
{
color:orange;
}
.slider a
{
padding: 10px 40px;
margin-right: 10px;
}
/*-------------slider-button-----------*/
.slider a.btn-half
{
background-color: orange;
color: white;
width:200px;
}
.slider a.btn-half:hover
{
opacity:0.7;
transition:0.5s ease-in;
}
.img2
{
background-image:linear-gradient(rgba(0,0,0,0.6),rgba(0,0,0,0.7)),url(work2.jpg);
background-size:100% 100%;
}
.img3
{
background-image:linear-gradient(rgba(0,0,0,0.6),rgba(0,0,0,0.7)),url(work3.jpg);
background-size:100% 100%;
}
.slider i
{
font-size:30px;
margin-right:10px;
}
/*-------------login-----------*/
.login-box
{
width:280px;
position:absolute;
top:1000px;
left:50%;
transform: translate(-50%, -50%);
color:white;
}
.login-box h1
{
width:100px;
font-size:40px;
border-bottom: 6px solid darkorange;
margin-bottom:50px;
padding:13 px 0;
}
.textbox
{
width:100%;
overflow:hidden;
font-size:20px;
padding:8px 0;
margin:8px 0;
border-bottom: 1px solid darkorange;
}
.textbox i
{
width:26px;
float:left;
text-align:center;
}
.textbox input
{
border:none;
outline:none;
background:none;
color:white;
font-size:17px;
width:80%;
float:left;
margin:0 10px;
}
.btn
{
width:100%;
background:none;
border:2px solid darkorange;
color:white;
padding:5px;
font-size:17px;
cursor:pointer;
margin:12px 0;
}
.btn:hover
{
opacity:0.7;
transition:0.5s ease-in;
}
/*-------------FAQ-----------*/
.fqcontainer
{
max-width: 60%;
margin:0 auto;
padding:70px 0 20px;
width:100%;
}
.fqcontainer h1
{
text-align: center;
font-family: 'roboto', 'sans-serif';
font-size: 60px;
margin:50px 0 0;
color: white;
}
.acc
{
border-bottom:1px solid white;
}
.acc h3
{
font-size:25px;
background-color: black rgba(0,0,0,0.6);
color: white;
padding:15px;
margin:0;
cursor:pointer;
font-family:'roboto','sans-serif';
letter-spacing: 2px;
position:relative;
}
.acc h3:after
{
content: '+';
position:absolute;
right: 20px;
font-size:40px;
top:50%;
transform:translateY(-50%);
}
.acc.active h3:after
{
content:'-';
}
.fqcontent
{
background-color:white;
margin-top:0;
line-height:1.5;
display:none;
}
.content-inner
{
padding:15px;
}
/*-------------footer-----------*/
.footer {
width:100%;
background-color: darkorange;
padding:50px 0px;
}
footer nav
{
text-align:center;
}
footer nav ul li a
{
padding-right: 25px;
font-weight: bold;
color: white;
transition: all 0.5s ease-in;
}
footer nav ul li a:hover
{
text-decoration: none;
color:black;
}
<html>
<body>
<!-------------Header/Nav----------->
<header>
<div class="container">
<div class="row">
<img src="logo.png">
<nav>
<ul>
<li>Log In</li>
<li>FAQ</li>
<li>My Surveys</li>
</ul>
</nav>
</div>
</div>
</header>
<!-------------Slider----------->
<section class="slider">
<ul class="slider-carousel" id="slider-carousel">
<li class="img1">
<h2>Slider<span>Slider</span></h2>
<p>Hello World</p>
<i class="fab fa-apple"></i>
<i class="fab fa-android"></i>
<i class="fab fa-windows"></i>
<p><br>Curabitur sodales sem nec nisl finibus, nec suscipit magna euismod.Praesent nibh leo, auctor vel po rttitor in, auctor et sapien.<br> Nullam et nulla rutrum, convallis tellus vitae, eleifend massa
</p><br>
Get Started
</li>
<li class="img2">
<h2>Slider<span>Slider</span></h2>
<p>Hello World</p>
<i class="fab fa-apple"></i>
<i class="fab fa-android"></i>
<i class="fab fa-windows"></i>
<p><br>Curabitur sodales sem nec nisl finibus, nec suscipit magna euismod.Praesent nibh leo, auctor vel po rttitor in, auctor et sapien.<br> Nullam et nulla rutrum, convallis tellus vitae, eleifend massa
</p><br>
Get Started
</li>
<li class="img3">
<h2>Slider<span>Slider</span></h2>
<p>Hello World</p>
<i class="fab fa-apple"></i>
<i class="fab fa-android"></i>
<i class="fab fa-windows"></i>
<p><br>Curabitur sodales sem nec nisl finibus, nec suscipit magna euismod.Praesent nibh leo, auctor vel po rttitor in, auctor et sapien.<br> Nullam et nulla rutrum, convallis tellus vitae, eleifend massa
</p><br>
Get Started
</li>
</ul>
</section>
<!-------------Login----------->
<div class="login-box">
<div id="login-box">
<h1>Login</h1>
<div class="textbox">
<i class="fas fa-user"></i>
<input type="text" placeholder="Username" name="" value="">
</div>
<div class="textbox">
<i class="fas fa-lock"></i>
<input type="text" placeholder="Password" name="" value="">
</div>
<input class="btn" type="button" name="" value="Sign In">
</div>
</div>
<!-------------FAQ----------->
<div class="fqcontainer">
<h1>FAQ Section</h1>
<div class="acc">
<h3>Question 1: What is?</h3>
<div class="fqcontent">
<div class="content-inner">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sapien turpis, tincidunt nec maximus et, elementum vel massa. Sed quis suscipit tortor, vel lacinia enim. Pellentesque posuere a urna eget fermentum. Vivamus tincidunt varius
turpis, eget suscipit arcu aliquam vel. Maecenas fermentum tellus vel euismod porttitor. Curabitur sodales sem nec nisl finibus, nec suscipit magna euismod. Praesent nibh leo, auctor vel porttitor in, auctor et sapien. Nullam et
nulla rutrum, convallis tellus vitae, eleifend massa</p>
</div>
</div>
</div>
<div class="acc">
<h3>Question 1: What is?</h3>
<div class="fqcontent">
<div class="content-inner">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sapien turpis, tincidunt nec maximus et, elementum vel massa. Sed quis suscipit tortor, vel lacinia enim. Pellentesque posuere a urna eget fermentum. Vivamus tincidunt varius
turpis, eget suscipit arcu aliquam vel. Maecenas fermentum tellus vel euismod porttitor. Curabitur sodales sem nec nisl finibus, nec suscipit magna euismod. Praesent nibh leo, auctor vel porttitor in, auctor et sapien. Nullam et
nulla rutrum, convallis tellus vitae, eleifend massa</p>
</div>
</div>
</div>
<div class="acc">
<h3>Question 1: What is?</h3>
<div class="fqcontent">
<div class="content-inner">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sapien turpis, tincidunt nec maximus et, elementum vel massa. Sed quis suscipit tortor, vel lacinia enim. Pellentesque posuere a urna eget fermentum. Vivamus tincidunt varius
turpis, eget suscipit arcu aliquam vel. Maecenas fermentum tellus vel euismod porttitor. Curabitur sodales sem nec nisl finibus, nec suscipit magna euismod. Praesent nibh leo, auctor vel porttitor in, auctor et sapien. Nullam et
nulla rutrum, convallis tellus vitae, eleifend massa</p>
</div>
</div>
</div>
</div>
<!-------------Footer----------->
<footer>
<div class="footer">
<nav>
<ul>
<li>Log In</li>
<li>FAQ</li>
<li>My Surveys</li>
</ul>
</nav>
</div>
</footer>
<script src="main.js"></script>
</body>
</html>
thats what you need to change/add in your css:
/*-------------login-----------*/
.login-box{
position: relative;
height: 100vh;
}
#login-box {
width: 280px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
}
your parent div of your login section (.login-box) needs a "position" value (eg: position: relative), then your Login Box gets position inside the .login-box.
with a background image you have to set a specific height for your parent div.
If you use an image-tag inside your .login-box div then the div would be as heigh as the image itself
running example (full code):
html body {
margin: 0;
padding: 0;
}
body {
height: 100%;
background-color: black !important;
}
/*-------------header-----------*/
header {
height: 110px;
line-height: 110px;
position: fixed;
z-index: 1;
width: 100%;
}
.secondary {
background-color: darkorange;
box-shadow: 0px 0px 15px 0px;
transition: all 0.5s ease-in-out;
}
/*-------------nav-----------*/
ul {
list-style: none;
}
ul li {
display: inline-block;
}
header nav {
float: right;
}
.logo img {
margin-top: -20px;
height: 30px;
}
header nav ul li a {
padding-right: 25px;
font-weight: bold;
color: white;
transition: all 0.5s ease-in;
}
header nav ul li a:hover {
text-decoration: none;
color: black;
}
/*-------------slider-----------*/
.img1 {
background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.7)), url(http://lorempixel.com/1920/1080/);
background-size: 100% 100%;
}
.slider,
.slider ul,
.slider ul li {
height: 100%;
width: 100%;
color: white;
text-align: center;
padding: 0px;
}
.slider h2 {
font-weight: bold;
margin-top: 260px;
}
.slider span {
color: orange;
}
.slider a {
padding: 10px 40px;
margin-right: 10px;
}
/*-------------slider-button-----------*/
.slider a.btn-half {
background-color: orange;
color: white;
width: 200px;
}
.slider a.btn-half:hover {
opacity: 0.7;
transition: 0.5s ease-in;
}
.img2 {
background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.7)), url(http://lorempixel.com/1920/1080/);
background-size: 100% 100%;
}
.img3 {
background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.7)), url(http://lorempixel.com/1920/1080/);
background-size: 100% 100%;
}
.slider i {
font-size: 30px;
margin-right: 10px;
}
/*-------------login-----------*/
.login-box{
position: relative;
height: 100vh;
}
#login-box {
width: 280px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
}
.login-box h1 {
width: 100px;
font-size: 40px;
border-bottom: 6px solid darkorange;
margin-bottom: 50px;
padding: 13 px 0;
}
.textbox {
width: 100%;
overflow: hidden;
font-size: 20px;
padding: 8px 0;
margin: 8px 0;
border-bottom: 1px solid darkorange;
}
.textbox i {
width: 26px;
float: left;
text-align: center;
}
.textbox input {
border: none;
outline: none;
background: none;
color: white;
font-size: 17px;
width: 80%;
float: left;
margin: 0 10px;
}
.btn {
width: 100%;
background: none;
border: 2px solid darkorange;
color: white;
padding: 5px;
font-size: 17px;
cursor: pointer;
margin: 12px 0;
}
.btn:hover {
opacity: 0.7;
transition: 0.5s ease-in;
}
/*-------------FAQ-----------*/
.fqcontainer {
max-width: 60%;
margin: 0 auto;
padding: 70px 0 20px;
width: 100%;
}
.fqcontainer h1 {
text-align: center;
font-family: 'roboto', 'sans-serif';
font-size: 60px;
margin: 50px 0 0;
color: white;
}
.acc {
border-bottom: 1px solid white;
}
.acc h3 {
font-size: 25px;
background-color: black rgba(0, 0, 0, 0.6);
color: white;
padding: 15px;
margin: 0;
cursor: pointer;
font-family: 'roboto', 'sans-serif';
letter-spacing: 2px;
position: relative;
}
.acc h3:after {
content: '+';
position: absolute;
right: 20px;
font-size: 40px;
top: 50%;
transform: translateY(-50%);
}
.acc.active h3:after {
content: '-';
}
.fqcontent {
background-color: white;
margin-top: 0;
line-height: 1.5;
display: none;
}
.content-inner {
padding: 15px;
}
/*-------------footer-----------*/
.footer {
width: 100%;
background-color: darkorange;
padding: 50px 0px;
}
footer nav {
text-align: center;
}
footer nav ul li a {
padding-right: 25px;
font-weight: bold;
color: white;
transition: all 0.5s ease-in;
}
footer nav ul li a:hover {
text-decoration: none;
color: black;
}
/* CHANGES */
.slider {
overflow: hidden;
max-height: 100vh;
}
<body>
<!-------------Header/Nav----------->
<header>
<div class="container">
<div class="row">
<img src="logo.png">
<nav>
<ul>
<li>Log In</li>
<li>FAQ</li>
<li>My Surveys</li>
</ul>
</nav>
</div>
</div>
</header>
<!-------------Slider----------->
<section class="slider">
<ul class="slider-carousel" id="slider-carousel">
<li class="img1">
<h2>Slider<span>Slider</span></h2>
<p>Hello World</p>
<i class="fab fa-apple"></i>
<i class="fab fa-android"></i>
<i class="fab fa-windows"></i>
<p><br>Curabitur sodales sem nec nisl finibus, nec suscipit magna euismod.Praesent nibh leo, auctor vel po rttitor in, auctor et sapien.<br> Nullam et nulla rutrum, convallis tellus vitae, eleifend massa
</p><br>
Get Started
</li>
<li class="img2">
<h2>Slider<span>Slider</span></h2>
<p>Hello World</p>
<i class="fab fa-apple"></i>
<i class="fab fa-android"></i>
<i class="fab fa-windows"></i>
<p><br>Curabitur sodales sem nec nisl finibus, nec suscipit magna euismod.Praesent nibh leo, auctor vel po rttitor in, auctor et sapien.<br> Nullam et nulla rutrum, convallis tellus vitae, eleifend massa
</p><br>
Get Started
</li>
<li class="img3">
<h2>Slider<span>Slider</span></h2>
<p>Hello World</p>
<i class="fab fa-apple"></i>
<i class="fab fa-android"></i>
<i class="fab fa-windows"></i>
<p><br>Curabitur sodales sem nec nisl finibus, nec suscipit magna euismod.Praesent nibh leo, auctor vel po rttitor in, auctor et sapien.<br> Nullam et nulla rutrum, convallis tellus vitae, eleifend massa
</p><br>
Get Started
</li>
</ul>
</section>
<!-------------Login----------->
<div class="login-box">
<div id="login-box">
<h1>Login</h1>
<div class="textbox">
<i class="fas fa-user"></i>
<input type="text" placeholder="Username" name="" value="">
</div>
<div class="textbox">
<i class="fas fa-lock"></i>
<input type="text" placeholder="Password" name="" value="">
</div>
<input class="btn" type="button" name="" value="Sign In">
</div>
</div>
<!-------------FAQ----------->
<div class="fqcontainer">
<h1>FAQ Section</h1>
<div class="acc">
<h3>Question 1: What is?</h3>
<div class="fqcontent">
<div class="content-inner">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sapien turpis, tincidunt nec maximus et, elementum vel massa. Sed quis suscipit tortor, vel lacinia enim. Pellentesque posuere a urna eget fermentum. Vivamus tincidunt varius turpis,
eget suscipit arcu aliquam vel. Maecenas fermentum tellus vel euismod porttitor. Curabitur sodales sem nec nisl finibus, nec suscipit magna euismod. Praesent nibh leo, auctor vel porttitor in, auctor et sapien. Nullam et nulla rutrum, convallis
tellus vitae, eleifend massa</p>
</div>
</div>
</div>
<div class="acc">
<h3>Question 1: What is?</h3>
<div class="fqcontent">
<div class="content-inner">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sapien turpis, tincidunt nec maximus et, elementum vel massa. Sed quis suscipit tortor, vel lacinia enim. Pellentesque posuere a urna eget fermentum. Vivamus tincidunt varius turpis,
eget suscipit arcu aliquam vel. Maecenas fermentum tellus vel euismod porttitor. Curabitur sodales sem nec nisl finibus, nec suscipit magna euismod. Praesent nibh leo, auctor vel porttitor in, auctor et sapien. Nullam et nulla rutrum, convallis
tellus vitae, eleifend massa</p>
</div>
</div>
</div>
<div class="acc">
<h3>Question 1: What is?</h3>
<div class="fqcontent">
<div class="content-inner">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sapien turpis, tincidunt nec maximus et, elementum vel massa. Sed quis suscipit tortor, vel lacinia enim. Pellentesque posuere a urna eget fermentum. Vivamus tincidunt varius turpis,
eget suscipit arcu aliquam vel. Maecenas fermentum tellus vel euismod porttitor. Curabitur sodales sem nec nisl finibus, nec suscipit magna euismod. Praesent nibh leo, auctor vel porttitor in, auctor et sapien. Nullam et nulla rutrum, convallis
tellus vitae, eleifend massa</p>
</div>
</div>
</div>
</div>
<!-------------Footer----------->
<footer>
<div class="footer">
<nav>
<ul>
<li>Log In</li>
<li>FAQ</li>
<li>My Surveys</li>
</ul>
</nav>
</div>
</footer>
<script src="main.js"></script>
</body>
</html>
I have a pure CSS CSS Expand/Collapse div which is based on someone else's code # here by default hidden text is collapsable but it would be better if the text expands after the click.
Anyone have suggestions on how to edit this code so that text is minimize before the click is minimized? It would be better if javascript is avoided and Wordpress compactible.
<main>
<h2>CSS Expand/Collapse Section</h2>
<input id="toggle" type="checkbox" checked>
<label for="toggle">Hidden Kitten</label>
<div id="expand">
<section>
<p>mew</p>
</section>
</div>
<section>
<h3>Other content</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas porta non turpis faucibus lobortis. Curabitur non eros rutrum, gravida felis non, luctus velit. Ut commodo congue velit feugiat lobortis. Etiam nec dolor quis nulla bibendum blandit vitae nec enim. Maecenas id dignissim erat. Aenean ac mi nec ante venenatis interdum quis vel lacus.
</p>
<p>Aliquam ligula est, aliquet et semper vitae, elementum eget dolor. In ut dui id leo tristique iaculis eget a dui. Vestibulum cursus, dolor sit amet lacinia feugiat, turpis odio auctor nisi, quis pretium dui elit at est. Pellentesque lacus risus, vulputate sed gravida eleifend, accumsan ac ante. Donec accumsan, augue eu congue condimentum, erat magna luctus diam, adipiscing bibendum sem sem non elit.</p>
</section>
</main>
CSS
#import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700);
body {
font-family: "Open Sans", Arial;
background: #CCC;
}
main {
background: #EEE;
width: 600px;
margin: 20px auto;
padding: 10px 0;
box-shadow: 0 3px 5px rgba(0,0,0,0.3);
}
h2 {
text-align: center;
}
p {
font-size: 13px;
}
input {
display: none;
visibility: hidden;
}
label {
display: block;
padding: 0.5em;
text-align: center;
border-bottom: 1px solid #CCC;
color: #666;
}
label:hover {
color: #000;
}
label::before {
font-family: Consolas, monaco, monospace;
font-weight: bold;
font-size: 15px;
content: "+";
vertical-align: text-top;
display: inline-block;
width: 20px;
height: 20px;
margin-right: 3px;
background: radial-gradient(ellipse at center, #CCC 50%, transparent 50%);
}
#expand {
height: 0px;
overflow: hidden;
transition: height 0.5s;
background: url(http://placekitten.com/g/600/300);
color: #FFF;
}
section {
padding: 0 20px;
}
#toggle:checked ~ #expand {
height: 250px;
}
#toggle:checked ~ label::before {
content: "-";
}
I think you are looking to have the image start collapsed.
All you need to do is remove the checked attribute from the input checkbox to achieve this.
Change:
<input id="toggle" type="checkbox" checked>
To:
<input id="toggle" type="checkbox">
Here is you code in a runable snippet:
body {
font-family: "Open Sans", Arial;
background: #CCC;
}
main {
background: #EEE;
width: 600px;
margin: 20px auto;
padding: 10px 0;
box-shadow: 0 3px 5px rgba(0, 0, 0, 0.3);
}
h2 {
text-align: center;
}
p {
font-size: 13px;
}
input {
display: none;
visibility: hidden;
}
label {
display: block;
padding: 0.5em;
text-align: center;
border-bottom: 1px solid #CCC;
color: #666;
}
label:hover {
color: #000;
}
label::before {
font-family: Consolas, monaco, monospace;
font-weight: bold;
font-size: 15px;
content: "+";
vertical-align: text-top;
display: inline-block;
width: 20px;
height: 20px;
margin-right: 3px;
background: radial-gradient(ellipse at center, #CCC 50%, transparent 50%);
}
#expand {
height: 0px;
overflow: hidden;
transition: height 0.5s;
background: url(http://placekitten.com/g/600/300);
color: #FFF;
}
section {
padding: 0 20px;
}
#toggle:checked~#expand {
height: 250px;
}
#toggle:checked~label::before {
content: "-";
}
<main>
<h2>CSS Expand/Collapse Section</h2>
<input id="toggle" type="checkbox">
<label for="toggle">Hidden Kitten</label>
<div id="expand">
<section>
<p>mew</p>
</section>
</div>
<section>
<h3>Other content</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas porta non turpis faucibus lobortis. Curabitur non eros rutrum, gravida felis non, luctus velit. Ut commodo congue velit feugiat lobortis. Etiam nec dolor quis nulla bibendum blandit
vitae nec enim. Maecenas id dignissim erat. Aenean ac mi nec ante venenatis interdum quis vel lacus.
</p>
<p>Aliquam ligula est, aliquet et semper vitae, elementum eget dolor. In ut dui id leo tristique iaculis eget a dui. Vestibulum cursus, dolor sit amet lacinia feugiat, turpis odio auctor nisi, quis pretium dui elit at est. Pellentesque lacus risus, vulputate
sed gravida eleifend, accumsan ac ante. Donec accumsan, augue eu congue condimentum, erat magna luctus diam, adipiscing bibendum sem sem non elit.</p>
</section>
</main>
Just remove checked in your input and you're good to go.
It should look like this:
<input id="toggle" type="checkbox">
I used this footer on my homepage and it worked fine, but copy and pasting it over to another webpage completely destroyed all the styling it had, which is weird, because the header (which I also copied from the same page) is completely fine and unchanged. Any thoughts? Here's a fiddle with all the code:
Okay, so I just put it into the fiddle and it worked fine, but it still doesn't work like it should when I open it in Chrome through Sublime Text.
Here's all the code:
HTML
<body>
<div class="header">
<div class="navbar">
<p class="navwords nonactive">Home</p>
<p class="navwords active">Our Team</p>
<p class="navwords nonactive">Weddings</p>
<p class="navwords nonactive">Events</p>
<p class="navwords nonactive">Contact</p>
</div>
<div class="headerlogo">
<a src="#"><img id="background" src="assets/BlurryFlowers.png"></a>
<img id="logo" src="assets/Logo.png">
</div>
</div>
<div class="ourteam">
<div class="employee" id="brax">
<h2>Brax</h2>
<img src="assets/Braxpic.png">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vitae arcu quis risus elementum auctor in eu erat. Nullam sodales pulvinar eros, semper euismod elit pretium sit amet. Vestibulum vestibulum libero id ipsum viverra, condimentum vulputate urna volutpat. In lobortis sit amet risus id vehicula. Praesent in risus at urna mollis eleifend vel et arcu. Quisque urna leo, porta non turpis sit amet, gravida sagittis erat. Curabitur eu convallis purus. Vestibulum feugiat purus ac urna aliquet rutrum.</p>
</div>
<div class="employee" id="ryan">
<h2>Ryan</h2>
<img src="assets/Ryanpic.png">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vitae arcu quis risus elementum auctor in eu erat. Nullam sodales pulvinar eros, semper euismod elit pretium sit amet. Vestibulum vestibulum libero id ipsum viverra, condimentum vulputate urna volutpat. In lobortis sit amet risus id vehicula. Praesent in risus at urna mollis eleifend vel et arcu. Quisque urna leo, porta non turpis sit amet, gravida sagittis erat. Curabitur eu convallis purus. Vestibulum feugiat purus ac urna aliquet rutrum.</p>
</div>
</div>
<div class="footer">
<div class="favicon">
<img id="favicon" src="assets/favicon.png">
</div>
<div class="footernav">
<p>Home</p>
<p>Our Team</p>
<p>Weddings</p>
<p>Events</p>
<p>Contact</p>
</div>
<div class="socialmedia">
<img class="social" src="assets/facebook.png">
<a class="socialText" href="https://www.facebook.com/yourstorybookmemory/"><p>Storybook Memories</p></a><br/>
<img class="social" src="assets/instagram.png">
<a class="socialText" href="https://www.instagram.com/yourstorybookmemory/"><p>yourstorybookmemory</p></a><br/>
<img class="social" src="assets/twitter.png">
<a class="socialText" href="https://twitter.com/sbvideography"><p>#sbvideography</p></a><br/>
<img class="social" src="assets/youtube.png">
<a class="socialText" href="https://www.youtube.com/channel/UCcMVbKyDIJN0Ht-6VjDiFKA"><p>Storybook Memories</p></a><br/>
<img class="social" src="assets/mail.png">
<a class="socialText" href="mailto:inquiries#yourstorybookmemory.com"><p>inquiries#yourstorybookmemory.com</p></a><br/>
</div>
</div>
</body>
CSS
/* PAGE SETUP */
*{
font-weight: 100;
}
body {
font-family: 'Lato', 'sans-serif';
width: 100%;
margin: 0px;
}
/* HEADER FOR ALL PAGES */
.header {
width: 100%;
}
.headerlogo {
top: 0;
left: 0;
position: relative;
}
#background {
width: 100%;
z-index: 2;
}
#logo {
z-index: 1;
text-align: center;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.navbar {
width: 100%;
background-color: rgba(96,150,38,0.4);
text-align: right;
position: absolute;
height: 55px;
top: 0;
left: 0;
z-index: 3;
}
.nonactive {
color: white;
}
.active {
color: black;
cursor: ;
}
.navwords {
display: inline-block;
margin: 15px;
vertical-align: middle;
font-size: 1em;
transition: .3s color;
font-weight: 300;
cursor: pointer;
}
.navwords:hover {
color: black;
}
/* OUR TEAM SECION */
/* FOOTER SECTION */
.footer {
background-color: #5c0e13;
color: white;
display: inline-block;
width: 100%;
}
.favicon, .footernav, .socialmedia {
float: left;
}
.favicon {
margin-left: 1%;
margin-top: 1%;
margin-right: 1%;
}
.footernav a {
text-decoration: none;
color: white;
transition: .3s color;
}
.footernav a:hover {
color: #db1421;
}
.socialmedia {
margin-left: 50%;
position: relative;
transform: translateY(10%);
}
.socialmedia p {
margin: 6px;
padding: 0;
}
.social {
width: 20px;
margin-right: 10px;
vertical-align: middle;
}
.socialmedia a {
text-decoration: none;
color: white;
transition: .3s color;
vertical-align: middle;
}
.socialmedia a:hover {
color: #db1421;
}
.socialText{
display:inline-block;
}
EDIT: Here is a screenshot of what it's doing right now:
And here is a fiddle with an example of it working (sort of, that maroon background means it's working, because that's not working on the screenshot).
https://jsfiddle.net/f26w8boe/
Help, have been working for hours on this HTML Page. I've been viewing it in Chrome, but when I resize the page I notice that the sidebars I've added cover up everything.
Here is what I wanted to do:
Have a scroll bar when the page is resized (Keeping the page the same)
Have one side bar one side, and to be able to slide over the page to find the other scroll bar. (I dont want the. covering everything up like they are now..)
Here is the code:
#img1 {
width: 400px;
padding-bottom: 25px;
}
#container1 {
text-align: center;
}
#heading-contain {
background-color: LightSeaGreen;
width: 650px;
margin: auto;
border-radius: 7px;
font-family: "adam", arial;
color: white;
}
#heading2 {
border-top: 1px solid white;
}
#heading1 {
position: relative;
top: 15px;
}
#heading2 h3 {
position: relative;
bottom: 6px;
color: DarkSlateGrey;
}
#main-content {
width: 650px;
margin: auto;
margin-top: 30px;
background-color: LightSlateGrey;
border-radius: 8px;
}
#text1 {
padding-bottom: 30px;
padding-top: 20px;
font-family: arial;
color: white;
margin-left: 20px;
margin-right: 20px;
line-height: 200%;
}
#name {
color: DarkSeaGreen;
font-weight: bold;
font-family: "dragon is coming";
font-size: 300%;
}
body {
background-image: url("https://lh4.ggpht.com/X5kjAhye8_5IE9Ws3Z0e05aIAsP_jCSbsh1hja0nNdF8GczkNd0aZQEe7w1V5-2B-9k=h900");
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
}
#footer {
background-color: LightSeaGreen;
color: white;
border: 1px double white;
border-bottom-right-radius: 8px;
border-bottom-left-radius: 8px;
height: 30px;
padding: 5px;
font-family: "adam";
font-weight: bold;
}
#footer p {
margin: 5px;
}
#name:hover {
color: LightCoral;
cursor: default;
}
#line1 {
text-align: center;
}
#paragraph {
text-indent: 50px;
display: inline-block;
}
#sidebar-left {
background-color: LightSeaGreen;
width: 200px;
height: 100%;
display: block;
position: absolute;
left: 0px;
top: 0px;
position: fixed;
font-family: "adam";
color: white;
}
ul {
margin: 0px;
padding: 0px;
}
ul li {
list-style: none;
}
ul li a {
background-color: LightSlateGrey;
color: white;
border-bottom: 1px solid white;
display: block;
width: 180px;
padding: 10px;
text-decoration: none;
}
li:hover {
background-color: DarkSeaGreen;
}
#sidebar-right {
background-color: LightSeaGreen;
width: 200px;
height: 100%;
position: absolute;
right: 0px;
top: 0px;
position: fixed;
font-family: "adam";
color: white;
}
#sidebar-right h4 {
width: 180px;
padding: 10px;
}
#sidebar-right img {
width: 160px;
margin-left: 20px;
margin-right: 20px;
margin-top: 10px;
}
#sidebar-right p {
font-size: 13px;
padding-right: 6px;
padding-left: 6px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML WEBPAGE 2 | Brett Carwile</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="container1">
<!-- Container1 contains all the elements on the page !-->
<div id="heading-contain">
<!-- Heading-container contains everything in the header !-->
<div id="heading1">
<!-- Heading1 is the top of the header which includes the h1 !-->
<h1>HTML Webpage 2</h1>
</div>
<div id="heading2">
<!-- Heading2 is the bottom half of the header including the h3 !-->
<h3>By Brett Carwile</h3>
</div>
</div>
<div id="sidebar-right">
<h4>About the Author</h4>
<img src="DSC00071.jpg">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras ullamcorper gravida facilisis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sed dui diam. Nulla facilisi. Donec rhoncus dolor malesuada urna commodo lacinia. Sed vel nisi
venenatis, aliquet nibh at, lobortis lacus. Etiam enim lacus, venenatis a sagittis ac, rhoncus in velit. Pellentesque turpis massa, condimentum eget eleifend non, sit amet justo. Vivamus accumsan iaculis placerat. Quisque blandit diam ut risus
ultrices rutrum. Mauris pretium in augue ut lobortis. Vivamus tempor ac nisl at euismod. Maecenas laoreet a erat a varius. Curabitur consequat nunc vehicula tellus ornare, vitae aliquet sapien varius.
</P>
</div>
<div id="sidebar-left">
<ul>
<li>Link 1
</li>
<li>Link 2
</li>
<li>Link 3
</li>
<li>Link 4
</li>
<li>Link 5
</li>
</ul>
<p>Check out the awesome links above!!</p>
</div>
<div id=main-content>
<!-- This div is the main area below the header (text, img ect...) !-->
<p id="text1">
<!-- This span is to seperate the first line from the rest of the text !-->
<span id="line1"> This is an HTML webpage by <span id="name">Brett Carwile</span>.</span>
<br>
<!-- This span is so that we can indent the text !-->
<span id="paragraph">This is a text sample. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed id quam nulla. Nam sollicitudin porta ligula, sit amet pharetra elit tincidunt sit amet. Suspendisse rhoncus, elit at consectetur sagittis, nisi eros molestie urna, et cursus elit sapien quis ante. Sed sit amet pulvinar neque. Pellentesque eget lorem ac lorem sodales rutrum. Nulla erat nisl, consequat non ante vitae, porttitor convallis magna. Duis pulvinar ornare nisi nec varius. Mauris tempus nisi non viverra vulputate. Interdum et malesuada fames ac ante ipsum primis in faucibus. Maecenas vestibulum viverra erat eu rhoncus.
Cras nec vulputate leo. Donec nunc mauris, varius id ligula eu, tincidunt euismod lorem. Praesent pharetra, ipsum et congue egestas, sapien augue feugiat lacus, ac tincidunt augue leo ut tortor. Mauris efficitur urna ut turpis ornare, eu consectetur lacus dapibus. Curabitur sit amet justo blandit est fermentum volutpat. Sed in gravida nunc. Integer sit amet risus in justo porttitor cursus. Mauris tortor purus, viverra a lacus et, suscipit molestie tortor. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; </span>
</p>
<img src="DSC00071.jpg" id="img1">
<div id="footer">
<p>Thank you for viewing!!! © Brett Carwile 2016</p>
</div>
</div>
</div>
</body>
</html>
You can try the HTML/CSS and resize the window to see what I mean.
Adding min-width to the body element and removing the position fixed for the sidebar-left and sidebar-right will make the trick. Please see below the modified css rules.
body {
min-width: 1200px; //Modify depending on your requirements
background-image: url("https://lh4.ggpht.com/X5kjAhye8_5IE9Ws3Z0e05aIAsP_jCSbsh1hja0nNdF8GczkNd0aZQEe7w1V5-2B-9k=h900");
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
}
#sidebar-left {
background-color: LightSeaGreen;
width: 200px;
height: 100%;
display: block;
position: absolute;
left: 0px;
top: 0px;
font-family: "adam";
color: white;
}
#sidebar-right {
background-color: LightSeaGreen;
width: 200px;
height: 100%;
position: absolute;
right: 0px;
top: 0px;
font-family: "adam";
color: white;
}
I hope it helps.