Skip to content Skip to sidebar Skip to footer

Content Hiding Above Div's

I have an adept knowledge in HTML/CSS but I'm having a problem that has more than stooped me. In order to test my skills, I build websites on TV Shows etc, and while designing one,

Solution 1:

For your menu issue, just set display:none; to your .nav and it will start not visible. For your other issue, I believe having your position set to absolute is what is causing the issue. By changing it to position:relative (and making the background green so you can see it), the div shows up and doesn't block the newsletter text. Absolute div's don't care what else is around it. It will be position relative to its nearest ancestor if set to absolute, which in the case of your HTML, is the <body>

Also, you label id="submitbox" but reference it in css with .submitbox instead of #submitbox

body {
	padding:0;
	margin: 0;
	font-family: 'Raleway';

}

.nav {
    display:none;
	background-color: black;
	text-decoration: none;
	color: silver;
	margin: 0;
	list-style: none;
	text-align: center;
}

.nav > li {
	display: block;
}

/* .nav > li:before {
	content: "*";
} */.nav > li > a {
	text-decoration: none;
	color: silver;
	font-size:24px;
	text-transform: uppercase;
	font-weight: bolder;
	letter-spacing: 4px;
}

.nav-btn {
	display:block;
	font-size: 30px;
	background-color: black;
	color: silver;
	text-align: center;
	cursor: pointer;
}

.image {
	background-image:url('download1.jpg');
	width:100%;
    max-height:400px;
    background-position: left center absolute;
    background-size: 100%;
    background-repeat: no-repeat;
    position: absolute;
}

.title {
	display: inline-block;
	color: white;
	position:relative;
	margin: 15%;
	text-transform: uppercase;
}

.image {
	text-align: center;
	position:relative;
  background-color:green;
}

.image > h2 {
	padding-top: 50%;
	line-height: 50%;
}


@media screen and (max-width: 411px) {
	.title > h2 {
		font-size: 15px;
	}

	.image {
		max-height:280px;
	}
}

.submitbox {
	color: yellow;
	background-color: darkblue;
	z-index: 1!important;
}
<!DOCTYPE html><head><title>Welcome to France!</title><linkrel="stylesheet"href="Reign.css"type="text/css"><linkhref='https://fonts.googleapis.com/css?family=Raleway'rel='stylesheet'type='text/css'></head><body><!-- <div id="header">"Today I am King!"</div> --><nav><spanclass="nav-btn">Menu</span><ulclass="nav"><li><ahref="#">Home</a></li><li><ahref="#">About</a></li><li><ahref="#">News</a></li><li><ahref="#">Contact</a></li></ul></nav><divclass="image"><divclass="title"><h2>"Today, I am king!"<br />Mary, Queen of Scots.</h2></div></div><divid="submitbox"><h2>Sign up for our Newsletter!</h2></div><p>hello</p><scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script><script>
$('span.nav-btn').click(function () {
	$('ul.nav').toggle();
});
</script></body>

Post a Comment for "Content Hiding Above Div's"