When opening the site in IE, there's unwanted 1px space under the footer. Chrome and Firefox shows correctly like I want (that means margin-bottom: 0).
The same bug appears while hovering the navigation items. There's 1px visible space. Again, only IE.
I would like to know why this is happening.
* {
padding: 0;
margin: 0;
}
header {
background: brown;
height: 100px;
width: auto;
min-width: 1200px;
margin-left: 0;
margin-right: 0;
padding-left: 0;
padding-right: 0;
}
h1 {
color: white;
font-family: calibri;
text-align: center;
padding-top: 25px;;
padding-left: 10px;
}
nav {
min-width: 1200px;
}
nav ul {
background: grey;
text-align: center;
-webkit-box-shadow: -1px 3px 5px 0px rgba(0,0,0,0.75);
-moz-box-shadow: -1px 3px 5px 0px rgba(0,0,0,0.75);
box-shadow: -1px 3px 5px 0px rgba(0,0,0,0.75);
}
nav ul li {
list-style-type: none;
display: inline-block;
padding: 20px;
}
nav ul li a {
text-decoration: none;
color: white;
padding: 20px;
font-family: verdana;
}
nav ul li:hover {
background: black;
cursor: pointer;
}
section {
background: darkblue;
height: 200px;
width: 500px;
margin-top: 20px;
margin-left: 15px;
}
article {
background: gold;
height: 800px;
width: 500px;
margin-top: 10px;
margin-left: 15px;
}
aside {
background: orange;
height: 1010px;
width: 600px;
float: right;
margin-top: -1010px;
margin-right: 20px;
}
div#content {
background: none;
width: 1200px;
margin: auto;
}
p {
text-align: center;
}
p#sider, #article, #section {
padding-top: 20px;
padding-left: 20px;
}
footer {
background: brown;
height: 40px;
width: auto;
margin-top: 20px;
margin-bottom: 0;
}
p#credits {
font-size: 15px;
font-family: verdana;
float: left;
margin-top: 10px;
margin-left: 15px;
}
p#logo {
font-size: 15px;
font-family: verdana;
float: right;
margin-top: 10px;
margin-right: 15px;
font-weight: bold;
}
#logoname {
heigh: 200px;
width: 200px;
margin: auto;
position: relative;
left: -40px;
top: -40px;
}
article, section, aside {
font-family: verdana;
font-size: 20px;
text-align: left;
}
<header>
<h1>Logo Picture</h1>
<div id="logoname">
<img src="http://www.ssbwiki.com/images/thumb/9/9a/DKSymbol%28preBrawl%29.png/50px-DKSymbol%28preBrawl%29.png">
</div>
</header>
<nav>
<ul>
<li>Home</li>
<li>News</li>
<li>Reference</li>
<li>Contact</li>
</ul>
</nav>
<div id="content">
<section>
<p> Hello there! This is a section and here it will be some pretty content about something pretty nice. </p>
</section>
<article>
<p> Hello again. This is an article about something new. What happened lately. You see?</p>
</article>
<aside>
<p id="sider">This is a sider. It is onn the left side of the website.
This is a sider. It is onn the left side of the website
This is a sider. It is onn the left side of the website
This is a sider. It is onn the left side of the website
This is a sider. It is onn the left side of the website
This is a sider. It is onn the left side of the website
This is a sider. It is onn the left side of the website
This is a sider. It is onn the left side of the website</p>
</aside>
</div>
<footer>
<p id="credits">Copyright 2015 | All rights reserved</p>
<p id="logo">Logo Name</p>
</footer>
Make sure you set properties for the body as well. so
body{margin:0;padding:0;width:100vw;height:100vh;}
IE is that annoying browser that unfortunately lots of people still use, but the body in every browser usually needs to be set like this.
Related
I am making a sidebar for my site and I want the side bar to fill the rest of the screen but also scroll separate to the right of the screen when it overflows with other elements inside. When I use 100% for the height the element only goes to the height of the last element inside of it.
I am trying to get it to fill the rest of the screen as I stated previously but it only goes to not all the way.
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
.main {
margin-left: 345px;
border: 0px solid #ffffff;
padding: 0px 0px;
flex-direction: column;
align-content: center;
text-align: center;
width: 450px;
}
.card {
display: inline-block;
width: 400px;
height: 160px;
background-color: #404040;
border: 1px solid #404040;
border-radius: 4px;
margin: 0px;
margin-top: 20px;
text-decoration: none;
}
.toptext {
display: inline-block;
width: 400px;
height: 45px;
color: #ffffff;
background-color: #ffffff;
border: 1px solid #ffffff;
border-radius: 4px;
margin: 0px;
margin-top: 5px;
text-decoration: none;
text-align: left;
}
.toptext h1 {
font-size: 20px;
margin-left: 0px;
margin-top: 1px;
color: #404040;
}
.toptext p {
font-size: 12px;
margin-left: 0px;
margin-top: -10px;
color: #404040;
}
.flexcolumn {
flex-direction: column;
}
.leftmain {
height: 100%;
width: 325px;
padding: 0px 10px;
flex-direction: column;
align-content: center;
background-color: #333333;
overflow: scroll;
}
.leftmain p {
float: left;
color: #ffffff;
text-align: left;
padding: 0px 10px;
text-decoration: none;
font-size: 12px;
line-height: 25px;
border-radius: 4px;
background-color: #333333;
width: 300px;
}
.leftmain p:hover {
background-color: #404040;
color: #ffffff;
}
.header {
overflow: hidden;
background-color: #404040;
padding: 10px 10px;
height: 36px;
text-align: center;
}
.header-right {
float: right;
padding: 0px 0px;
}
.header a {
float: left;
color: #ffffff;
text-align: center;
padding: 5px 10px;
text-decoration: none;
font-size: 18px;
line-height: 25px;
border-radius: 4px;
align-content: center;
}
.header a:hover {
background-color: #333333;
color: #ffffff;
}
<div class="header">
📄 My Paper Company
<div class="header-right">
Settings
Contact
Donate
<div class="flexcolumn">
</div>
</div>
</div>
<div id="leftmain" class="leftmain">
<p id="button" div="leftmain" onclick='show("htpmain")'>📢 How To Play</p>
</div>
<center>
<div id=htpmain class="main">
<div class="toptext">
<h1>
📢 How To Play
</h1>
<p>This guide will get you start the game and will be helpful to grasp everything you need to do.
</p>
</div>
<div class="card" />
</div>
</center>
Your leftmain IS taking up 100% of the space available to it, leftmain stops when it reaches . You have leftmain set to flex-direction: column;
when only the .main should have it. Also don't use the tag, it is no longer supported in HTML5 and is display: block; when it should be inline-block.
I would change just to and set display to inline-block and set a width so the leftmain has room to go past it.
I hope this solves your problem.
.leftmain {
height: 100%;
width: 325px;
padding: 0px 10px;
align-content: center;
background-color: #333333;
overflow: scroll;
}
#nameOfCenterDiv {
position: absolute;
left: 300px;
display: inline-block;
}
Give to the sidebar a position fixed so it always stays there wherever you scroll and and a margin-left to your content on the right (the width of the margin-left must be the same of sidebar width)
.leftmain{
position: fixed
}
.main{
margin-left: 345px;
width: 450px //remove this so it's 100%
}
You have to wrap the left sidebar and right panel within the same container.
Using the display: flex on the container, you no longer need to specify a 100% height for the left sidebar since it will automatically fill in the remaining space.
You also need to remove the margin-left rule for the right content so that it lays nicely with the sidebar.
You can optionally set a max-height of 100vh to the sidebar so that it scrolls when its content exceeds the viewport height.
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
.main {
border: 0px solid #ffffff;
padding: 0px 0px;
flex-direction: column;
align-content: center;
text-align: center;
width: 450px;
}
.card {
display: inline-block;
width: 400px;
height: 160px;
background-color: #404040;
border: 1px solid #404040;
border-radius: 4px;
margin: 0px;
margin-top: 20px;
text-decoration: none;
}
.toptext {
display: inline-block;
width: 400px;
height: 45px;
color: #ffffff;
background-color: #ffffff;
border: 1px solid #ffffff;
border-radius: 4px;
margin: 0px;
margin-top: 5px;
text-decoration: none;
text-align: left;
}
.toptext h1 {
font-size: 20px;
margin-left: 0px;
margin-top: 1px;
color: #404040;
}
.toptext p {
font-size: 12px;
margin-left: 0px;
margin-top: -10px;
color: #404040;
}
.flexcolumn {
flex-direction: column;
}
.container {
display: flex;
}
.leftmain {
width: 325px;
padding: 0px 10px;
flex-direction: column;
align-content: center;
background-color: #333333;
overflow: scroll;
}
.leftmain p {
float: left;
color: #ffffff;
text-align: left;
padding: 0px 10px;
text-decoration: none;
font-size: 12px;
line-height: 25px;
border-radius: 4px;
background-color: #333333;
width: 300px;
}
.leftmain p:hover {
background-color: #404040;
color: #ffffff;
}
.header {
overflow: hidden;
background-color: #404040;
padding: 10px 10px;
height: 36px;
text-align: center;
}
.header-right {
float: right;
padding: 0px 0px;
}
.header a {
float: left;
color: #ffffff;
text-align: center;
padding: 5px 10px;
text-decoration: none;
font-size: 18px;
line-height: 25px;
border-radius: 4px;
align-content: center;
}
.header a:hover {
background-color: #333333;
color: #ffffff;
}
<div class="header">
📄 My Paper Company
<div class="header-right">
Settings
Contact
Donate
<div class="flexcolumn">
</div>
</div>
</div>
<div class="container">
<div id="leftmain" class="leftmain">
<p id="button" div="leftmain" onclick='show("htpmain")'>📢 How To Play</p>
</div>
<center>
<div id=htpmain class="main">
<div class="toptext">
<h1>
📢 How To Play
</h1>
<p>This guide will get you start the game and will be helpful to grasp everything you need to do.
</p>
</div>
<div class="card" />
</div>
</center>
</div>
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I'm working on my website and the heading (h1) text is taking up two lines, which it has space for but shouldn't as it has plenty of space to just take up one line. I want it to only span one line, and I'm wondering why it isn't doing that? Thanks!
The text I'm taking about is the <h1>, id="welcome", content Welcome to my website!.
P.S. if your going to run the code snippet make sure to do it full screen to see the effect.
Here's my Code:
li {
display: inline-block;
}
ul {
float: right;
margin: 0px;
padding: 0px;
position: relative;
top: -45px;
}
nav li a:link {
font-weight: bold;
display: inline-block;
text-decoration: none;
font-family: times;
font-size: 24px;
list-style: none;
padding: 5px;
margin: 3px;
margin-top: 0px;
border: 2px solid black;
border-radius: 5px;
color: black;
}
nav li a:visited {
color: rgba(0,0,0,0.7);
}
nav li a:hover {
background-color: rgba(0,0,0,0.6);
color: white;
}
nav li a:active {
color: black;
border-color: black;
}
nav {
width: 1000px;
height: 130px;
background-color: rgba(255,255,255,0.7);
padding: 10px;
margin: 0px auto;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
input[type=search] {
font-size: 16px;
}
#searchbox {
float: right;
}
#logo {
width: 200px;
font-family: arial;
margin: 0px;
padding: 0px;
font-size: 26px;
}
#logo_jeff, #logo_arries, #logo_website {
margin: 0px;
}
#logo_jeff {
letter-spacing: 35.5px;
}
#logo_arries {
letter-spacing: 11px;
}
#logo_website {
letter-spacing: 4px;
}
body {
background-image: url("../pictures/jeff_skiing.jpg");
background: red;
min-height: 500px;
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
margin: 0px;
padding: 0px;
}
aside {
position: absolute;
right: 0px;
background-color: rgba(255,255,255,0.9);
width: 170px;
height: 600px;
margin: 0;
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
padding: 10px;
}
#main_content {
width: 1000px;
min-height: 600px;
display: block;
background-color: rgba(255,255,255,0.7);
margin: 0 auto;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
position: relative; top: 0px;
padding: 10px;
}
#here_you_can_learn {
font-size: 47px;
color: gray;
margin: 0 auto;
margin-bottom: 10px;
text-align: center;
}
#welcome {
border: 1px solid #999;
color: rgb(0, 0, 110);
font-size: 100px;
margin: 10px;
margin-top: 20px;
margin-bottom: 130px;
padding: 0px;
}
#down_arrow {
height: 50px;
margin: auto;
display: block;
padding: 10px;
}
#most_frequent {
width: 600px;
vertical-align: top;
display: inline-block;
background-color: rgba(0,0,0,0.1);
border-radius: 3px;
}
#m_f_heading {
font-size: 30px;
margin: 10px;
padding: 5px;
text-align: center;
background-color: rgba(0,0,0,0.2);
border-radius: 5px;
}
#m_f_show_more {
font-size: 20px;
margin: 10px;
padding: 5px;
text-align: center;
background-color: rgba(0,0,0,0.2);
border-radius: 5px;
}
#recent_activity {
width: 375px;
display: inline-block;
background-color: rgba(0,0,0,0.1);
border-radius: 3px;
}
#r_a_heading {
font-size: 30px;
margin: 10px;
padding: 5px;
text-align: center;
background-color: rgba(0,0,0,0.2);
border-radius: 5px;
}
#r_a_body {
font-size: 15px;
margin: 10px;
padding: 5px;
text-align: center;
background-color: rgba(0,0,0,0.2);
border-radius: 5px;
}
#r_a_show_more {
font-size: 20px;
margin: 10px;
padding: 5px;
text-align: center;
background-color: rgba(0,0,0,0.2);
border-radius: 5px;
}
#r_a_show_more_link:visited {
color: black;
}
#r_a_show_more_link:hover {
color: gray;
background-color: rgba(0,0,0,0.9);
}
#r_a_show_more_link:active {
color: black;
}
<!DOCTYPE html>
<head>
<title>Home | Jeff's Website</title>
<link href="styles/main_navigation.css" type="text/css" rel="stylesheet" />
<link href="styles/body.css" type="text/css" rel="stylesheet" />
<link href="styles/main_content.css" type="text/css" rel="stylesheet" />
</head>
<body>
<!--Main Nav-->
<header>
<nav>
<form action="" id="searchbox">
<input id="search_input" type="search" name="searchmysite" placeholder="Search my Site!">
<input type="submit" value="Search!">
</form>
<div id="logo">
<h1 id="logo_jeff">JEFF</h1>
<h1 id="logo_arries">ARRIES</h1>
<h1 id="logo_website">WEBSITE</h1>
</div>
<ul>
<li>Home</li>
<li>Blog</li>
<li>Trips</li>
<li>Politics</li>
<li>Pictures</li>
<li>Videos</li>
<li>Computer</li>
<li>Misc</li>
</ul>
</nav>
</header>
<!--Welcome to jeff's website-->
<div>
<h1 id="welcome">Welcome to my Website!</h1>
<p id="space_filler"></p>
<a href="#here_you_can_learn">
<img src="pictures/down_arrow.png" id="down_arrow"/>
</a>
</div>
<!--right side nav-->
<aside>
<p>this is aside</p>
</aside>
<!--Main Content-->
<div id="main_content">
<h2 id="here_you_can_learn">Here you can learn about me and my adventures!</h2>
<!--Most Frequently visited pages: on left side of page-->
<div id="most_frequent">
<p id="m_f_heading">Most frequently visted pages!</p>
<p id="m_f_show_more">Show More</p>
</div>
<!--Recent Activity: on the right side of page-->
<div id="recent_activity">
<p id="r_a_heading">Recent Activity</p>
<p id="r_a_body">test</p>
<p id="r_a_show_more">Show More</p>
</div>
</div>
</body>
It's being caused by the floats on your search-box and on your ul menu. If you're going to use floats you should clear them, although in general, floating things just causes more problems than it fixes.
Add a clear-fix for your header:
header::after {
clear: both;
content: '';
display: table;
}
CodePen
Try using "display: inline-block;" at the end of your 'welcome' CSS.
#welcome {
border: 1px solid #999;
color: rgb(0, 0, 110);
font-size: 100px;
margin: 10px;
margin-top: 20px;
margin-bottom: 130px;
padding: 0px;
display: inline-block;
}
You can use padding instead of margin.
here is the code
#welcome {
border: 1px solid #999;
color: rgb(0, 0, 110);
font-size: 100px;
margin: 0;
padding: 10px 10px 20px 10px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-o-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
Below code after padding are css3 that helps in cross browser compatibility
I'm currently reading Headfirst CSS/HTML and I'm having an issue with an example.
I'm attempting to float the body to the left of the sidebar using float:left; however it's not floating properly. I've been over the HTML and CSS an I can't quite see what's wrong.
This is what I want it to look like:
And the fiddle: https://jsfiddle.net/Taubin/7Lhz4wtd/
#main {
background: #efe5d0 url(images/background.gif) top left;
font-size: 105%;
padding: 15px;
margin: 0px 10px 10px 10px;
width: 420px;
float: left;
}
<div id="allcontent">
<div id="header">
</div>
<div id="sidebar">
<p class="beanheading">
Sidebar text
</p>
<p>
Sidebar text
</p>
</div>
<div id="main">
<h1>QUALITY COFFEE, QUALITY CAFFEINE</h1>
<p>
Main text
</p>
</div>
</div>
Any suggestions would be greatly appreciated.
First, it might be the issue that you are adding margin and paddings, which add size to the box even though the box has a width of 420px, you have to calculate margins and paddings to, or use * { box-sizing: border-box; }, which will calculate the width of that element as a sum of all the sizes (padding, margin, width) and not exceed the width.
Second, the order of the elements are important when floating, put main always on top of the sidebar, since elements start as top to bottom, when you float a top element, the bottom element if its wider, will collapse and align with the main box.
Screenshot for reference:
Here is the https://jsfiddle.net/bg2v0dqn/.
You shouldn't add a large gap with margin.
Here's what I changed:
#main {
background: #efe5d0 url(images/background.gif) top left;
font-size: 105%;
padding: 15px;
margin: 0px 10px 10px 10px;
width: 420px;
float: left;
}
#sidebar {
background: #efe5d0 url(images/background.gif) bottom right;
font-size: 105%;
padding: 15px;
margin: 0px 10px 10px 0;
width: 290px;
float: right;
}
#sidebar {
background: #efe5d0 url(images/background.gif) bottom right;
font-size: 105%;
padding: 15px;
margin: 0px 10px 10px 0px;
float: right;
width: 290px;
}
Try this CSS code
body {
background-color: #b5a789;
font-family: Georgia, "Times New Roman", Times, serif;
font-size: small;
margin: 0px;
display: table;
}
#header {
background-color: #675c47;
margin: 10px;
height: 108px;
}
#main {
background: #efe5d0 url(images/background.gif) top left;
font-size: 105%;
padding: 15px;
margin: 0px 10px 10px 10px;
width: 420px;
display: table-cell;
}
#sidebar {
background: #efe5d0 url(images/background.gif) bottom right;
font-size: 105%;
padding: 15px;
margin: 0px 10px 10px 10px;
width: 300px;
display: table-cell;
float: right;
}
#footer {
background-color: #675c47;
color: #efe5d0;
text-align: center;
padding: 15px;
margin: 10px;
font-size: 90%;
clear: left;
}
h1 {
font-size: 120%;
color: #954b4b;
}
.slogan { color: #954b4b; }
.beanheading {
text-align: center;
line-height: 1.8em;
}
a:link {
color: #b76666;
text-decoration: none;
border-bottom: thin dotted #b76666;
}
a:visited {
color: #675c47;
text-decoration: none;
border-bottom: thin dotted #675c47;
}
#allcontent {
width: 800px;
padding-top: 5px;
padding-bottom: 5px;
background-color: #675c47;
}
I need a some help with positioning a static Google Maps map.
There are two problems:
Having the static map on the same level/line as the writing, the writing on the left and the map on the right
Keeping the footer on the bottom of the page
CodePen DEMO
HTML:
<div class="wrapper">
<ul class="nav">
<li class="home">Home
</li>
<li class="location">Location
</li>
<li class="itinerary">Itinerary
</li>
<li class="photos">Howard & Mary
</li>
</ul>
</div>
<h1>Location</h1>
<p class="grid">USS NORTH CAROLINA
<br/>Address: 1 Battleship Rd NE, Wilmington, NC 28401, United States Telephone: + 1 910-251-5797 wesbite: www.battleshipnc.com/
</p>
<div class="map">
<p class="static_map">
<img src="http://maps.googleapis.com/maps/api/staticmap?parameters?key=AIzaSyDM-P7a6oHU7e-guJpKQPADlGPtX1_iPBU&size=400x300&sensor=false&markers=1+Battleship+Rd,+Wilmington,+North+Carolina+28401" alt+ "1 Battleship Rd, Wilmington, North Carolina 28401"/>
</p>
</div>
<script type = "text/javascript" src = "js/jquery.js"></script>
<script type="text/javascript" src="https: //maps.googleapis.com/maps/api/js?key=AIzaSyDM-P7a6oHU7e-guJpKQPADlGPtX1_iPBU&sensor=false"></script>
<footer class="main-footer">
<h1 class="tri">All donations & proceeds will go towards Dare 2 Tri</h1>
</footer>
CSS:
body {
background-image: url("http://i.istockimg.com/file_thumbview_approve/1985611/2/stock-photo-1985611-uss-north-carolina.jpg");
background-repeat: no-repeat;
background-size: cover;
}
h1 {
text-align: center;
color: #0051c2;
font-size: 80px;
}
.grid {
color: #0051c2;
font-size: 40px;
width: 45%;
margin-left: 10px;
}
.map {
margin-right: 10px;
float: right;
}
.wrapper {
position: relative;
top: 10px;
height: 175px;
width: 1100px;
background-color: black;
opacity: 0.8;
margin: auto;
border-radius: 10px;
z-index: 0;
}
.main-footer {
position: absolute;
bottom: 0;
width: 100%;
height: 50px;
background-color: black;
opacity: 0.8;
text-align: center;
}
.tri {
color: white;
font-size: 16px;
}
ul.nav {
display: inline;
color: white;
text-decoration: none;
text-align: center;
padding: 8px 15px;
border-radius: 5px;
text-align: auto;
}
ul.nav li {
float: left;
margin-left: 50px;
}
ul.nav li.home {
padding: 35px 15px;
margin: 20px;
top: 15px;
font-weight: 100;
height: 55px;
width: 130px;
font-size: 40px;
}
ul.nav li.home:hover {
background-color: #0051c2;
border-radius: 8px;
}
ul.nav li.location {
padding: 35px 15px;
margin: 20px;
font-weight: 100;
top: 15px;
height: 55px;
width: 180px;
border-radius: 5px;
font-size: 40px;
}
ul.nav li.location:hover {
background-color: #0051c2;
border-radius: 8px;
}
ul.nav li.itinerary {
padding: 35px 15px;
margin: 20px;
font-weight: 100;
height: 55px;
width: 200px;
border-radius: 5px;
font-size: 40px;
}
ul.nav li.itinerary:hover {
background-color: #0051c2;
border-radius: 8px;
}
ul.nav li.photos {
padding: 35px 15px;
margin: 20px;
margin-left: 20px;
border: 0;
font-weight: 120;
height: 55px;
width: 250px;
border-radius: 5px;
font-size: 40px;
}
ul.nav li.photos:hover {
background-color: #0051c2;
border-radius: 8px;
}
ul.nav li a {
color: #faf3bc;
display: block;
text-decoration: none;
}
First Issue: Aligning address with map
Make your 'grid' p into a div and add float:left to your .grid CSS.
Example: http://codepen.io/anon/pen/kwJcE
Second Issue: Sticky Footer
Duplicate question, see here: Make footer stick to bottom of page correctly
Direct link: "A CSS Sticky Footer that just works"
Bonus Third Issue: Terrible Design
I would never tell anyone they are learning 'wrong' but check out grid systems/frameworks, especially responsive grid systems. It will help you build faster with a better aesthetic.
So I'm building a site and I want to have little tabs on the right hand side that will change the content on the main page without having to refresh the entire page, like an embedded page within the main page. I am working from a template (HTML and CS) and trying to modify the existing content. In the code you can notice that there is an ordered list which defines the buttons (Like Homepage and etc) and when hovered over they change background and look fancy, but they don't actually do anything. I've been reading up about how to make them change the page (by following a link) but I am confused and can't figure out how to do it. I was hoping you guys could help me. I'm very noobish to HTML and CSS and just trying to put something together and learn from example while also building a private site. Thank you for your help in advance!
INDEX.HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>/rootbox</title>
<link href='http://fonts.googleapis.com/css?family=Oswald:400,300' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Abel' rel='stylesheet' type='text/css'>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="wrapper">
<div id="header-wrapper">
<div id="header" class="container">
<div id="logo">
<h1>Rootbox</h1>
</div>
<div id="menu">
<ul>
<li class="current_page_item">Homepage</li>
<li>Distros</li>
<li>Wifi</li>
<li>Tools</li>
<li>Contact</li>
</ul>
</div>
</div>
<div id="banner">
<div class="content"><img src="images/title.png" width="1000" height="300" alt="" /></div>
</div>
</div>
<!-- end #header -->
<div id="page">
<div id="content">
<div class="post">
<h2 class="title">Welcome to /rootbox</h2>
<div style="clear: both;"> </div>
<div class="entry">
<p>/rootbox is a collection of Security oriented Tools, Tutorials, Resources and Websites.This site offers a collection of well documented and freely available tools and resources for both a begginer pen-tester and the professional white-hat. Everything on this site is simply a collection, thus no original content is posted. All links have been tested and properly checked for security. All software published here is free and available directly from the author's site. Tutorials are often updated and deprecated software is removed.
</br></br>
This site is hosted on Panckake.io - A web framework which allows for publishing websites directly from Dropbox. For more information go here.If you need any additional help, or have any feedback or suggestions, send an email to rushone2010#gmail.com.
</p>
</div>
</div>
</div>
</div>
<!-- end #content -->
</div>
<div id="footer">
<p>Copyright (c) 2012. All rights reserved. Design by FCT</p>
</div>
<!-- end #footer -->
</body>
</html>
STYLE.CSS
body {
margin: 0;
padding: 0;
background: #050505 url(images/img01.jpg) repeat;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #5B5B5B;
}
h1, h2, h3 {
margin: 0;
padding: 0;
text-transform: uppercase;
font-weight: normal;
font-family: 'Oswald', sans-serif;
font-weight: 200;
color: #222222;
}
h1 {
font-size: 2em;
}
h2 {
font-size: 2.8em;
}
h3 {
font-size: 1.6em;
}
p, ul, ol {
margin-top: 0;
line-height: 180%;
}
ul, ol {
}
a {
color: #5E5E5E;
}
a:hover {
}
#wrapper {
background: #FFFFFF url(images/img05.jpg) repeat;
}
.container {
width: 1000px;
margin: 0px auto;
}
/* Header */
#header-wrapper {
overflow: hidden;
}
#header {
width: 1000px;
height: 150px;
margin: 0 auto;
padding: 0px 0px;
}
/* Logo */
#logo {
float: left;
width: 300px;
margin: 0;
padding: 0;
color: #FFFFFF;
}
#logo h1, #logo p {
}
#logo h1 {
line-height: 120px;
letter-spacing: -2px;
font-size: 3.8em;
}
#logo h1 a {
color: #1F1F1F;
text-shadow: 1px 1px 0px rgba(0,0,0,.2);
}
#logo p {
margin: 0;
padding: 0px 0 0 0px;
letter-spacing: -1px;
font: normal 18px Georgia, "Times New Roman", Times, serif;
font-style: italic;
color: #8E8E8E;
}
#logo p a {
color: #8E8E8E;
}
#logo a {
border: none;
background: none;
text-decoration: none;
color: #000000;
}
/* Splash */
#splash {
width: 960px;
height: 300px;
margin: 0px auto;
}
/* Search */
#search {
float: right;
width: 280px;
height: 60px;
padding: 20px 0px 0px 0px;
}
#search form {
height: 41px;
margin: 0;
padding: 10px 0 0 20px;
}
#search fieldset {
margin: 0;
padding: 0;
border: none;
}
#search-text {
width: 170px;
padding: 6px 5px 2px 5px;
border: 1px solid #E7EBED;
background: #FFFFFF;
text-transform: lowercase;
font: normal 11px Arial, Helvetica, sans-serif;
color: #5D781D;
}
#search-submit {
width: 50px;
height: 22px;
border: none;
background: #B9B9B9;
color: #000000;
}
/* Menu */
#menu {
float: right;
width: 500px;
height: 90px;
margin: 0 auto;
padding: 0;
}
#menu ul {
float: right;
margin: 0;
padding: 20px 0px 0px 0px;
list-style: none;
line-height: normal;
}
#menu li {
float: right;
}
#menu a {
display: block;
line-height: 100px;
margin-right: 1px;
padding: 0px 20px 0px 20px;
text-decoration: none;
text-align: center;
text-shadow: 1px 1px 0px rgba(0,0,0,.2);
text-transform: uppercase;
font-family: 'Oswald', sans-serif;
font-size: 16px;
font-weight: 300;
color: #1F1F1F;
border: none;
}
#menu a:hover, #menu .current_page_item a {
background: url(images/img01.jpg) repeat;
text-decoration: none;
color: #FFFFFF;
}
#menu .current_page_item a {
}
/* Page */
#page {
width: 1000px;
margin: 0 auto;
padding: 30px 0px;
}
/* Content */
#content {
padding: 0px 0px 0px 0px;
}
.post {
overflow: hidden;
margin-bottom: 40px;
border-bottom: 1px solid #E7EBED;
}
.post .title {
padding: 0px 0px 0px 0px;
letter-spacing: -1px;
}
.post .title a {
border: none;
text-decoration: none;
color: #222222;
}
.post .meta {
margin-bottom: 30px;
padding: 10px 0px 0px 0px;
text-align: left;
font-family: 'Abel', sans-serif;
font-size: 16px;
font-weight: 300;
}
.post .meta .date {
float: left;
}
.post .meta .posted {
float: right;
}
.post .meta a {
}
.post .entry {
padding: 0px 0px 40px 0px;
text-align: justify;
}
.links {
padding-top: 20px;
margin-bottom: 30px;
}
.more {
display: block;
float: left;
width: 88px;
padding: 5px 5px;
margin-right: 10px;
background: #222222;
color: #FFFFFF;
text-align: center;
text-decoration: none;
}
.comments {
display: block;
float: left;
width: 88px;
padding: 5px 5px;
background: #222222;
color: #FFFFFF;
text-align: center;
text-decoration: none;
}
/* Sidebar */
#sidebar {
float: left;
width: 270px;
margin: 0px;
padding: 30px 0px 0px 0px;
}
#sidebar ul {
margin: 0;
padding: 0;
list-style: none;
}
#sidebar li {
margin: 0;
padding: 0;
}
#sidebar li ul {
margin: 0px 0px;
padding-bottom: 30px;
}
#sidebar li li {
line-height: 40px;
border-bottom: 1px solid #E7EBED;
margin: 0px 0px;
border-left: none;
}
#sidebar li li span {
display: block;
margin-top: -20px;
padding: 0;
font-size: 11px;
font-style: italic;
}
#sidebar li li a {
padding: 0px 0px 0px 20px;
background: url(images/img04.jpg) no-repeat left 50%;
}
#sidebar h2 {
height: 38px;
padding: 0px 0px 30px 0px;
letter-spacing: -.5px;
font-size: 1.8em;
color: #222222;
}
#sidebar p {
margin: 0 0px;
padding: 0px 30px 20px 30px;
text-align: justify;
}
#sidebar a {
border: none;
}
#sidebar a:hover {
text-decoration: underline;
}
/* Calendar */
#calendar {
}
#calendar_wrap {
padding: 20px;
}
#calendar table {
width: 100%;
}
#calendar tbody td {
text-align: center;
}
#calendar #next {
text-align: right;
}
/* Three Column Footer Content */
#footer-content {
overflow: hidden;
width: 1000px;
margin: 0px auto;
color: #D6E2F0;
}
#footer-content a {
color: #92A9B6;
}
#footer-bg {
overflow: hidden;
padding: 30px 0px;
background: #E8E8E8;
}
#footer-content h2 {
margin: 0px;
padding: 0px 0px 20px 0px;
letter-spacing: -1px;
font-size: 26px;
color: #262626;
}
#footer-content #fbox1 {
float: left;
width: 300px;
margin-right: 50px;
}
#footer-content #fbox2 {
float: left;
width: 300px;
}
#footer-content #fbox3 {
float: right;
width: 300px;
}
#footer-content a {
}
#column1 {
float: left;
width: 290px;
margin-right: 30px;
}
#column2 {
float: left;
width: 280px;
}
#column3 {
float: right;
width: 260px;
}
/* Footer */
#footer {
height: 140px;
margin: 0 auto;
padding: 50px 0 15px 0;
font-family: 'Abel', sans-serif;
}
#footer p {
margin: 0;
padding-top: 10px;
letter-spacing: 1px;
line-height: normal;
font-size: 14px;
text-transform: uppercase;
text-align: center;
color: #5E5E5E;
}
#footer a {
color: #5E5E5E;
}
#marketing {
overflow: hidden;
margin-bottom: 30px;
padding: 20px 0px 10px 0px;
border-top: 1px solid #E7EBED;
border-bottom: 1px solid #E7EBED;
}
#marketing .text1 {
float: left;
margin: 0px;
padding: 0px;
letter-spacing: -2px;
text-transform: lowercase;
font-size: 34px;
color: #345E9B;
}
#marketing .text2 {
float: right;
}
#marketing .text2 a {
display: block;
width: 252px;
height: 38px;
padding: 15px 0px 0px 0px;
background: url(images/img07.jpg) no-repeat left top;
letter-spacing: -2px;
text-align: center;
text-transform: lowercase;
font-size: 30px;
color: #FFFFFF;
}
#banner {
margin: 0px auto;
width: 1000px;
height: 340px;
background: url(images/img03.png) no-repeat left bottom;
}
#banner .content {
}
.list-style1 {
margin: 0px;
padding: 0px;
list-style: none;
}
.list-style1 a {
color: #7F7F7F;
}
<script type='text/javascript'>
$(document).ready(function() {
$('#menu #tab1').on('mouseover', function () {
$('#page').show();
$('#page2,#page3,#page4,#page5').hide();
});
$('#menu #tab2').on('mouseover', function () {
$('#page2').show();
$('#page,#page3,#page4,#page5').hide();
});
$('#menu #tab3').on('mouseover', function () {
$('#page3').show();
$('#page,#page2,#page4,#page5').hide();
});
$('#menu #tab4').on('mouseover', function () {
$('#page4').show();
$('#page,#page2,#page3,#page5').hide();
});
$('#menu #tab5').on('mouseover', function () {
$('#page5').show();
$('#page,#page2,#page3,#page4').hide();
});
});
</script>
Try this on your script and html..
<div id="wrapper">
<div id="header-wrapper">
<div id="header" class="container">
<div id="logo">
<h1>Rootbox</h1>
</div>
<div id="menu">
<ul>
<li class="current_page_item" id="tab1">Homepage</li>
<li id="tab2">Distros</li>
<li id="tab3">Wifi</li>
<li id="tab4">Tools</li>
<li id="tab5">Contact</li>
</ul>
</div>
</div>
<div id="banner">
<div class="content"><img src="images/title.png" width="1000" height="300" alt="" /></div>
</div>
</div>
<!-- end #header -->
<div id="page">
<div class="content">
<div class="post">
<h2 class="title">Welcome to /rootbox</h2>
<div style="clear: both;"> </div>
<div class="entry">
<p>/rootbox is a collection of Security oriented Tools, Tutorials, Resources and Websites.This site offers a collection of well documented and freely available tools and resources for both a begginer pen-tester and the professional white-hat. Everything on this site is simply a collection, thus no original content is posted. All links have been tested and properly checked for security. All software published here is free and available directly from the author's site. Tutorials are often updated and deprecated software is removed.
</br></br>
This site is hosted on Panckake.io - A web framework which allows for publishing websites directly from Dropbox. For more information go here.If you need any additional help, or have any feedback or suggestions, send an email to rushone2010#gmail.com.
</p>
</div>
</div>
</div>
</div>
<div id="page2">
<div class="content">
<div class="post">
<h2 class="title">page2</h2>
</div>
</div>
</div>
<div id="page3">
<div class="content">
<div class="post">
<h2 class="title">page3</h2>
</div>
</div>
</div>
<div id="page4">
<div class="content">
<div class="post">
<h2 class="title">page4</h2>
</div>
</div>
</div>
<div id="page5">
<div class="content">
<div class="post">
<h2 class="title">page5</h2>
</div>
</div>
</div>
</div>
Add this to your style..
#page2, #page3, #page4, #page5{
display:none;
width: 1000px;
margin: 0 auto;
padding: 30px 0px;
}
note:change the #content to class type..
If i were you, i would use css property
display: none;
on the elements that you are hiding initially, then use jquery's
.toggle()
method to fade in the elements when the user clicks the link. As in
$('.target').toggle();
Where target is the name of your div id.
IF you are looking for a way to load content on mouseover, here is what I would suggest:
Use a little bit o' jQuery and AJAX:
$("#menu a").on("mouseover",function(){
//Get url of link
var url = $(this).attr('href');
//Perform ajax call to said link
$.ajax(
{
url:"/echo/json",
success:function(data){
//USED FOR MOCKING PURPOSES ONLY
data = exampleContent;
//Append the data to your content wrapper
$("#page #content").html(data[url]);
}
});
});
Here is a working example
This is a fancier version with fading. I call that a splash of awesome