html * {
box-sizing: border-box;
padding:0;
margin:0;
}
html,
body {
height: 100%;
font-family: 'Roboto', sans-serif;
color:#666666;
line-height: 1.7em;
}
body {
/* Location of the image */
background-image: url(1.jpg);
/* Background image is centered vertically and horizontally at all times */
background-position: center center;
/* Background image doesn't tile */
background-repeat: no-repeat;
/* Background image is fixed in the viewport so that it doesn't move when
the content's height is greater than the image's height */
background-attachment: fixed;
/* This is what makes the background image rescale based
on the container's size */
background-size: cover;
/* Set a background color that will be displayed
while the background image is loading */
background-color: #464646;
}
#full_2, #full_3, #full_4{
position: relative;
height: 100vh;
width: 100%;
}
#full_1 {
position: relative;
height: 100vh;
width: 100%;
}
#full_1 {
background: black;
opacity: 0.36;
}
#full_4 {
background: magenta;
}
#full_2 {
background: white;
}
#full_3 {
background: lightgray;
}
.arrow-down {
position: absolute;
bottom: 10px;
width: 45px;
height: 45px;
left: calc(50% - 16px);
}
.arrow-down a img {
width: 100%;
}
.logo{float: left; width: 30%;height: 100%;padding-top: 25px;padding-left: 25px;}
.main-nav {float: right; width: 60%; height: 100%;}
.menu {
background-color: #373737;
left: -285px;
height: 100%;
position: fixed;
width: 285px;
z-index: 5;
}
#main-header a{
text-decoration: none;
color: #ffffff;
font-size:2.0em;
z-index: 10;
opacity: 1;
}
#main-header a:hover{
color: #585858;
}
#main-header {
position: absolute;
width:100%;
height:70px;
top:0;
background-color: rgba(0,0,0,0);
z-index: 100;
}
#main-header ul li {
display:inline;
padding:20px 20px;
}
#main-header ul {
float: right;
margin-top:0px;
padding:0;
padding-top: 25px;
padding-right: 25px;
text-align: right;
}
#container{
width: 90%;
}
#lupa{
float: right;
width: 40%;
height: 100%;
}
#lupa img{516 918
width: 90px;
height: 492px;
float: right;
padding-top: 90px;
}
#content_1{
float: left;
height: 100%;
width: 60%;
}
#content_container{
padding-top: 125px;
height: 100%;
width: 100%;
padding-left: 35%;
}
#nadpis1{
margin-bottom: 45px;
}
#nadpis1 img{
width: 231px;
height: 44px;
}
#content_1_1 a{
color: #014FC4;
text-decoration: none;
font-weight: 800;
font-size: 25px;
}
#content_1_1 h2, p{
color: #2F2F2F;
font-size: 25px;
text-decoration: none;
}
#footer_left{
height: 90%;
float: left;
width: 40%;
}
.footer_1, .footer_2{
height: 100%;
width: 50%;
}
.footer_1{
float: left;
}
.footer_2{
float:right;
}
.footer_3{
}
#full_5{
height:100vh;
background-color: #0F032D;
bottom: 0;
}
.footer_bottom{
color: white;
height: 10%;
width: 100%;
text-align: center;
clear: both;
bottom: 0;
padding-bottom: 10px;
z-index: 10;
}
#full_5 ul{
padding-right: 25px;
padding-top: 25px;
}
#full_5 ul li{
padding-top: 25px;
}
#full_5 ul li a{
color: white;
text-decoration: none;
font-size: 16px;
}
#media only screen and (min-width: 320px) and (max-width: 768px) {
html * {
box-sizing: border-box;
padding:0;
margin:0;
}
html,
body {
height: 100%;
font-family: 'Roboto', sans-serif;
color:#666666;
line-height: 1.7em;
}
body {
/* Location of the image */
background-image: url(1.jpg);
/* Background image is centered vertically and horizontally at all times */
background-position: center center;
/* Background image doesn't tile */
background-repeat: no-repeat;
/* Background image is fixed in the viewport so that it doesn't move when
the content's height is greater than the image's height */
background-attachment: fixed;
/* This is what makes the background image rescale based
on the container's size */
background-size: cover;
/* Set a background color that will be displayed
while the background image is loading */
background-color: #464646;
}
#full_2, #full_3, #full_4{
position: relative;
height: 100vh;
width: 100%;
}
#full_1 {
position: relative;
height: 100vh;
width: 100%;
}
#full_1 {
background: black;
opacity: 0.36;
}
#full_4 {
background: magenta;
}
#full_2 {
background: white;
}
#full_3 {
background: lightgray;
}
.arrow-down {
position: absolute;
bottom: 10px;
width: 45px;
height: 45px;
left: calc(50% - 16px);
}
.arrow-down a img {
width: 100%;
}
#full_2 .arrow-down a img {
width: 100%;
display: none;
}
.logo{float: left; width: 30%;height: 100%;padding-top: 25px;padding-left: 25px;}
.main-nav {float: right; width: 60%; height: 100%;}
.menu {
background-color: #373737;
left: -285px;
height: 100%;
position: fixed;
width: 285px;
z-index: 5;
}
#main-header a{
text-decoration: none;
color: #ffffff;
font-size:2.0em;
z-index: 10;
opacity: 1;
}
#main-header a:hover{
color: #585858;
}
#main-header {
position: absolute;
width:100%;
height:70px;
top:0;
background-color: rgba(0,0,0,0);
z-index: 100;
}
#main-header ul li {
display:inline;
padding:20px 20px;
}
#main-header ul {
float: right;
margin-top:0px;
padding:0;
padding-top: 25px;
padding-right: 25px;
text-align: right;
}
#container{
width: 95%;
margin-right: auto;
margin-left: auto;
}
#lupa{
text-align: center;
width: 100%;
height: 100%;
float: none;
}
#lupa img{516 918
width: 90px;
height: 492px;
float: none;
padding-top: 0px;
}
#content_1{
height: 100%;
width: 100%;
text-align: center;
}
#content_container{
padding-top: 100px;
height: 100%;
width: 100%;
padding-left: 0px;
margin-bottom: 20px;
}
#nadpis1{
margin-bottom: 45px;
}
#nadpis1 img{
width: 231px;
height: 44px;
}
#content_1_1 a{
color: #014FC4;
text-decoration: none;
font-weight: 800;
font-size: 25px;
}
#content_1_1 h2, p{
color: #2F2F2F;
font-size: 25px;
text-decoration: none;
}
}
<!DOCTYPE html>
<html>
<head>
<title>Add gospel Přerov</title>
<link href="styles.css" rel="stylesheet" type="text/css">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link
href='http://fonts.googleapis.com/css?family=Roboto:300&subset=latin,cyrillic-ext'
rel='stylesheet' type='text/css'>
</head>
<div class="menu" >
</div>
<div id="wrapper">
<div id="main-header">
<div class="logo">
<a href="http://david.addagio.cz/gospel"><img src=""
style="max-width: 90%; height: auto;" alt="gospel logo" /></a>
</div>
<!--/.logo-->
<div class="main-nav">
<nav class="nav">
<ul>
<li class="nav-item">Aktuálně</li>
<li class="nav-item">O nás</li>
<li class="nav-item">Kontakt
<li class="nav-item">Foto/Video
</ul>
</nav>
</div>
</div>
<div id="full_1">
<div class="arrow-down">
<img src="arrow_down.png" alt="arrow-down">
</div>
</div>
<div id="full_2">
<div id="container">
<div id="content_1">
<div id="content_container">
<div id="nadpis1">
<img src="where.png" alt="where">
</div>
<div id="content_1_1">
<p>Už z našeho jména vyplívá, že se nacházíme
ve městě Přerov. Klikněte na lupu a získáte
přesnou navigaci.
Jsme od Vás příliš daleko?
kontaktujte nás zde</p>
</div>
</div>
</div>
<div id="lupa">
<img src="lupa.png">
</div>
</div>
<div class="arrow-down">
<img src="arrow_down_black.png" alt="arrow-down">
</div>
</div>
<div id="full_3">
<div class="arrow-down">
<img src="arrow_down.png" alt="arrow-down">
</div>
</div>
<div id="full_4">
<div class="arrow-down">
<img src="arrow_down.png" alt="arrow-down">
</div>
</div>
<div id="full_5">
<div id="footer_left">
<div class="footer_1">
<ul>
<li>Podmínky použití</li>
<li>Kontakty</li>
<li>Novinky</li>
<li>Fotky</li>
</ul>
</div>
<div class="footer_2">
</div>
</div>
<div class="footer_3">
</div>
<div class="footer_bottom">
</div>
</div>
</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript" src="main.js">
$('.icon-menu').click(function() {
$('.menu').animate({
left: "0px"
}, 200);
$('body').animate({
left: "285px"
}, 200);
});
/* Then push them back */
$('.icon-close').click(function() {
$('.menu').animate({
left: "-285px"
}, 200);
$('body').animate({
left: "0px"
}, 200);
});
};
</script>
</body>
</html>
Hi,
Well, i am making a website.. it contains 5 divs, (full_1, full_2, full_3, full_4, full_5), all those divs are height:100vh; and width:100%;
there is a
body {
/* Location of the image */
background-image: url(1.jpg);
/* Background image is centered vertically and horizontally at all times */
background-position: center center;
/* Background image doesn't tile */
background-repeat: no-repeat;
/* Background image is fixed in the viewport so that it doesn't move when
the content's height is greater than the image's height */
background-attachment: fixed;
/* This is what makes the background image rescale based
on the container's size */
background-size: cover;
/* Set a background color that will be displayed
while the background image is loading */
background-color: #464646;
}
now, everything just works great, but the last div has a little line below it, like 1px line (this line looks like there is a space at the bottom, below the div, cause the line looks like the background image mentioned before...)
This problem I have seen only in Microsoft Edge, but I only tried Edge and Chrome(Chrome displays it really great)
Here are photos from a) Edge , b) Chrome.
Hope, you can see it...
Also... the code snippet is maybe wrong... but it could help.
PS: Site is optimized for phones and tablets.
PPS: for clear look at the website, visit: http://david.addagio.cz/gospel
Just give boxshadow of 1px with same color on bottom
box-shadow: #0f032d 0px 1px 0;
Related
I need the images and links that are in the footer to be at the bottom of the footer, and the footer needs to still be at the bottom of the page.
I have tried using position: absolute and bottom properties and played with the margin properties but nothing I do seems to work any help would be much appreciated here.
body {
padding: 0;
margin: 0;
}
.headerBackgroundImage {
/* The image used */
background-image: url("../Images/headerImage.jpg");
min-height: 318px;
/* Center the image */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
/* Needed to position the navbar */
position: relative;
}
/* Code that applies only to the logo to position it and make sure it is infront of the background */
#logo {
position: relative;
display: block;
margin-left: 850px;
width: 15%;
top: 20px;
}
/* Position the navigation bar container inside the image */
.container1 {
position: absolute;
bottom: 0px;
}
/* Another container for the second part of the navigation bar */
.container2 {
position: absolute;
bottom: 0px;
right: 0;
}
/* The navigation bar */
.topnav {
overflow: hidden;
}
/* The links/words in the navigation bar */
.topnav a {
float: left;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: underline;
font-size: 50px;
font-weight: bold;
}
/* What happens to the links/words in the navigation bar once it is hovered over */
.topnav a:hover {
text-decoration: none;
}
.ImageColumn {
float: right;
width: 780px;
}
#ImageColumnImages {
width: 100%;
height: 40%;
padding-bottom: 10px;
}
footer {
left: 0;
bottom: 0;
height: 318px;
width: 100%;
overflow: hidden;
position: static;
}
.footerBackgroundImage {
/* The image used */
background-image: url("../Images/FooterImage.png");
min-height: 318px;
/* Center the image */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
/* Needed to position the navbar */
position: relative;
}
#footerImages {
height: 100px;
width: 100px;
padding-bottom: 10px;
position: sticky;
bottom: 0;
}
.footerLinks a {
color: #f2f2f2;
font-size: 20px;
padding-right: 10px;
text-decoration: underline;
font-weight: bold;
}
.footerLinks a:hover {
text-decoration: none;
}
.test {
bottom: 0px;
}
<body>
<div class="headerBackgroundImage">
<img src="../Images/logo.png" id="logo">
<div class="container1">
<div class="topnav">
Attractions
Restaurants
</div>
</div>
<div class="container2">
<div class="topnav">
Hotels
Transport
</div>
</div>
</div>
<div class="ImageColumn">
<img src="../Images/indexImage1.png" id="ImageColumnImages">
<img src="../Images/indexImage2.png" id="ImageColumnImages">
<img src="../Images/indexImage3.png" id="ImageColumnImages">
<img src="../Images/indexImage4.png" id="ImageColumnImages">
</div>
<footer>
<div class="test">
<div class="footerBackgroundImage">
<img src="../Images/facebook.png" id="footerImages">
<img src="../Images/instagram.png" id="footerImages">
<img src="../Images/twitter.png" id="footerImages">
<div class="footerLinks">
Contact Us
Refrences
</div>
</div>
</div>
</footer>
</body>
Using display: flex on the footer makes this work. By aligning the content with flex-end it positions itself on the bottom of the page.
Learning grids and flex boxes really makes life easier.
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
footer {
/*Added display flex and align-items*/
display: flex;
align-items: flex-end;
height: 318px;
width: 100%;
overflow: hidden;
position: static;
}
.test {
/*Set the div test to 100%*/
width: 100%;
}
.footerBackgroundImage {
...
/*added background color for testing purposes */
background-color: #e3e3e3;
}
body {
padding: 0;
margin: 0;
}
.headerBackgroundImage {
/* The image used */
background-image: url("../Images/headerImage.jpg");
min-height: 318px;
/* Center the image */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
/* Needed to position the navbar */
position: relative;
}
/* Code that applies only to the logo to position it and make sure it is infront of the background */
#logo {
position: relative;
display: block;
margin-left: 850px;
width: 15%;
top: 20px;
}
/* Position the navigation bar container inside the image */
.container1 {
position: absolute;
bottom: 0px;
}
/* Another container for the second part of the navigation bar */
.container2 {
position: absolute;
bottom: 0px;
right: 0;
}
/* The navigation bar */
.topnav {
overflow: hidden;
}
/* The links/words in the navigation bar */
.topnav a {
float: left;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: underline;
font-size: 50px;
font-weight: bold;
}
/* What happens to the links/words in the navigation bar once it is hovered over */
.topnav a:hover {
text-decoration: none;
}
.ImageColumn {
float: right;
width: 780px;
}
#ImageColumnImages {
width: 100%;
height: 40%;
padding-bottom: 10px;
}
footer {
display: flex;
height: 318px;
width: 100%;
overflow: hidden;
position: static;
align-items: flex-end;
}
.test {
width: 100%;
}
.footerBackgroundImage {
/* The image used */
background-image: url("../Images/FooterImage.png");
/* Center the image */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
/* Needed to position the navbar */
background-color: #e3e3e3;
width: 100%;
}
.footerImages {
height: 100px;
width: 100px;
padding-bottom: 10px;
}
.footerLinks a {
color: #f2f2f2;
font-size: 20px;
padding-right: 10px;
text-decoration: underline;
font-weight: bold;
}
.footerLinks a:hover {
text-decoration: none;
}
.test {
bottom: 0px;
}
<body>
<div class="headerBackgroundImage">
<img src="../Images/logo.png" id="logo">
<div class="container1">
<div class="topnav">
Attractions
Restaurants
</div>
</div>
<div class="container2">
<div class="topnav">
Hotels
Transport
</div>
</div>
</div>
<div class="ImageColumn">
<img src="../Images/indexImage1.png" id="ImageColumnImages">
<img src="../Images/indexImage2.png" id="ImageColumnImages">
<img src="../Images/indexImage3.png" id="ImageColumnImages">
<img src="../Images/indexImage4.png" id="ImageColumnImages">
</div>
<footer>
<div class="test">
<div class="footerBackgroundImage">
<img src="../Images/facebook.png" class="footerImages">
<img src="../Images/instagram.png" class="footerImages">
<img src="../Images/twitter.png" class="footerImages">
<div class="footerLinks">
Contact Us
Refrences
</div>
</div>
</div>
</footer>
</body>
Set the footer to have margin: 100%;. That should put it to the bottom.
I have searched the internet for quite a few hours now and cannot figure out why my site is responsive on the desktop but not on mobile (at least on my iphone X). On mobile, all of my elements except the gif at the top of the page are over to the left and half hidden outside the browser window (with no horizontal scroll bar btw). I have the viewport meta tag in there, which is the only solution I could find, but it did not do anything to my site's mobile view when I checked after adding it in. What else could the problem be? I am very much a beginner, so I am hoping this is just a dumb little mistake. Someone please help. I'm about to tear my hair out here!
You can visit the site here and resize to see how it should be, this is how it looks on mobile currently (not a full view btw, just a shot of the bottom sections of my site as you can see the problem most clearly from there):
Mobile Screenshot
here is my code:
<!doctype html>
<!-- This comment line needed for bootstrap to work on mobile devices -->
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title>Jasmine Thorson</title>
<link href="style.css" rel="stylesheet" type="text/css" media="screen">
</head>
<body>
<ul id="menu">
<li>WORK</li>
<li>ABOUT</li>
<li>SKILLS</li>
<li>CONTACT</li>
</ul>
<div id="top"></div>
<div id="box0">
<img src="headergif_vert.gif" alt="myhero" class="hero">
</div>
<div id="work">
<div id="box1">
</div>
<div id="box2">
</div>
<div id="box3">
</div>
<div id="box4">
</div>
<div id="box5">
</div>
<div id="box6">
</div>
<div id="box7">
</div>
<div id="box8">
</div>
<div id="box9">
</div>
<div id="box10">
</div>
</div>
<div id="about"></div>
<img src="ABOUTGIF.gif" class="aboutgif" alt="aboutgif">
<div id="aboutme">
<h1 class="abouthead">I'm a young creative fresh out of college with lots of <mark class="pink">charisma.</mark></h1>
<p class="para">I believe that good design can help people laugh, cry, stay informed, & understand each other better. Design, simply, is visual communication.</p>
<p class="para">As a designer + photographer, it's my goal to capture the essence of my subject & express that essence in the most clear, consistent, & appropriate manner.</p>
</div>
<div id="skills"></div>
<div class="w3-container">
<table class="table1">
<tr>
<td><img src="ICONS_BRANDING.png" alt="branding" class="icon1"></td>
<td><img src="ICONS_INFOGRAPHICS.png" alt="info" class="icon1"></td>
</tr>
<tr>
<td><img src="ICONS_DIGITAL.png" alt="digital" class="icon1"></td>
<td><img src="ICONS_SOCIAL.png" alt="social" class="icon1"></td>
</tr>
</table>
<table class="table2">
<tr>
<td><img src="ICONS_BRANDING.png" alt="branding" class="icon2"></td>
<td><img src="ICONS_INFOGRAPHICS.png" alt="info" class="icon2"></td>
<td><img src="ICONS_DIGITAL.png" alt="digital" class="icon2"></td>
<td><img src="ICONS_SOCIAL.png" alt="social" class="icon2"></td>
</tr>
</table>
</div>
<div id="contact"></div>
<div id="contactbox">
<div class="col1"><h2>JASMINE THORSON</h2></div>
<div class="col5"><h2>INFO</h2></div>
<div class="col1">Graphic Designer + Photographer</div>
<div class="col2">Brooklyn, NY</div>
<div class="col3">605 + 268 + 3245</div>
<div class="col4">jnthorson#gmail.com</div>
<div class="col5">Resume</div>
</div>
<footer>
<img src="insta.png" id="insta" alt="gram" class="social">
<img src="behance.png" id="behance" alt="be" class="social">
</footer>
</body>
</html>
And here is my CSS:
#charset "UTF-8";
body {
background-color: #DBD9D6;
margin: 0;
padding: 0;
font-family: "Arial Rounded MT Bold";
color: #978B87;
}
p {
font-family: Geneva;
font-size: .75em;
line-height: 1.5em;
}
h1{
line-height: 1.25em;
}
h4{
color: #D41773;
column-span: all;
}
h5{
color: #D41773;
font-size: .65em;
}
#menu {
list-style-type: none;
margin: 20px;
padding: 0px;
width: 80px;
position: fixed;
font-family: "Arial Rounded MT Bold";
font-size: 9px;
line-height: 10px;
right: 0;
text-align: right;
z-index: 4;
}
#menu li, #menu a {
display: block;
color: black;
opacity: .35;
padding: 2px;
text-decoration: none;
}
#menu li, #menu a:hover {
background-color: transparent;
color: #D41773;
opacity: 1;
transition: color 0.3s linear;
}
#menu li, #menu a:active {
background-color: transparent;
color: #D41773;
}
#logo {
position: fixed;
display: inline-block;
margin: 20px;
width: 207px;
height: 53px;
background-image: url("logoheader.png");
z-index: 4;
}
#logo:hover {
background-image: url(logoheader.png);
background-position: 0 -54.5px;
}
img.hero {
display: block;
height: 100vh;
padding: 0px;
margin-left: auto;
margin-right: auto;
}
#box0{
height: 100vh;
width: 100%;
background-color: #DBD9D6;
background-size: cover;
display: table;
background-attachment: fixed;
margin-left: auto;
margin-right: auto;
}
#box1{
height: 60vh;
width: 100%;
background-image: url(box1.jpg);
background-size: cover;
display: table;
background-attachment: fixed;
}
#box2{
height: 60vh;
width: 100%;
background-image: url(box2.jpg);
background-size: cover;
display: table;
background-attachment: fixed;
}
#box3{
height: 60vh;
width: 100%;
background-image: url(box3.jpg);
background-size: cover;
display: table;
background-attachment: fixed;
}
#box4{
height: 60vh;
width: 100%;
background-image: url(box4.jpg);
background-size: cover;
display: table;
background-attachment: fixed;
}
#box5{
height: 60vh;
width: 100%;
background-image: url(box5.jpg);
background-size: cover;
display: table;
background-attachment: fixed;
}
#box6{
height: 60vh;
width: 100%;
background-image: url(box6.jpg);
background-size: cover;
display: table;
background-attachment: fixed;
}
#box7{
height: 60vh;
width: 100%;
background-image: url(box7.jpg);
background-size: cover;
display: table;
background-attachment: fixed;
}
#box8{
height: 60vh;
width: 100%;
background-image: url(box8.jpg);
background-size: cover;
display: table;
background-attachment: fixed;
}
#box9{
height: 60vh;
width: 100%;
background-image: url(box9.jpg);
background-size: cover;
display: table;
background-attachment: fixed;
}
#box10{
height: 60vh;
width: 100%;
background-image: url(box10.jpg);
background-size: cover;
display: table;
background-attachment: fixed;
}
#aboutme {
margin-top: 150px;
margin-bottom: 200px;
margin-left: 25%;
margin-right: 75%;
width: 300px;
}
.abouthead{
font-size: 1.5em;
}
.para{
font-size: .55em;
}
mark.pink{
color: #D41773;
background: none;
}
.aboutgif{
float: right;
width: 200px;
margin-bottom: 50px;
margin-top: 20px;
}
#media screen and (max-width: 480px) {
.aboutgif{
display: none;
}
}
#media screen and (max-width: 768px) {
#aboutme{
width: 200px;
}
}
#media screen and (max-width: 480px) {
#aboutme{
width: 250px;
}
}
#media screen and (min-width: 768px) {
#aboutme{
width: 370px;
}
}
#media screen and (max-width: 768px) {
.abouthead{
font-size: 1.5em;
}
}
#media screen and (min-width: 768px) {
.abouthead{
font-size: 2em;
}
}
#media screen and (max-width: 480px) {
.abouthead{
font-size: 1.5em;
}
}
#media screen and (max-width: 480px) {
.para{
width: 200px;
}
}
#media screen and (max-width: 768px) {
.para{
font-size: .25em;
}
}
.w3-container{
background-color: #C5BBB6;
margin-top: 100px;
padding: 10px;
}
.table1{
width: 350px;
table-layout: fixed;
border-spacing: 0px;
margin: 0 auto;
margin-top: 100px;
margin-bottom: 100px;
text-align: center;
}
#media screen and (min-width: 768px) {
.table1{
display: none;
}
}
.table2{
width: 650px;
table-layout: fixed;
border-spacing: 0px;
margin: 0 auto;
margin-top: 100px;
margin-bottom: 100px;
text-align: center;
}
#media screen and (max-width: 768px) {
.table2{
display: none;
}
}
td{
padding-top: 20px;
vertical-align: top;
border-spacing: 0px;
}
.icon1{
width: 85px;
padding: 5px;
}
.icon2{
width: 110px;
padding: 5px;
}
#contactbox{
float: left;
width: 85%;
margin-left: 10%;
margin-top: 40px;
margin-bottom: 40px;
column-count: 5;
column-rule-width: 0px;
font-size: .5em;
}
#contactheaders{
column-span: all;
display: inline;
}
.col1{
float: left;
width: 100%;
}
.col2{
float: left;
width: 100%;
}
.col3{
float: left;
width: 100%;
}
.col4{
float: left;
width: 100%;
}
.col5{
float: left;
width: 100%;
}
footer{
position: fixed;
display: inline;
padding: 40px;
left: 0;
bottom: 0;
margin-bottom: 0px;
width: 100%;
height: 10px;
background: none;
color: black;
z-index: 5;
}
.photo{
float: left;
margin-right: 10%;
font-size: .6em;
opacity: .25;
color: black;
}
#insta{
width: 25px;
float: right;
margin-right: 65px;
padding-left: 5px;
}
#behance{
width: 25px;
float: right;
margin-left: 10%;
}
#behance.social, #insta.social {
opacity: 0.25;
filter: alpha(opacity=50);
transition: 0.3s linear;
}
#behance.social:hover, #insta.social:hover {
opacity: 1.0;
filter: alpha(opacity=100);
}
As I said before, I am a BEGINNER. Literally a beginner. We did not really learn this stuff in school, we were allowed to use Muse instead and I was afraid of how confusing coding looked so I am learning right now and I'm sorry if my code is just disgustingly awful, but I could really use some help! I ran both codes through validators and came out with minimal errors (which I fixed).
I think one possible solution would be to center your entire page. Keep your HTML as it is, and add this CSS:
html,
body {
width: 100%;
margin: 0 auto;
}
This will tell your html and body to be centered.
I hope this helps.
I'm practicing my HTML by making a website, and I'm making a header with buttons.
I'm trying to make the button the full height of the header, but it's going out of the header for some reason, and not going to the top.
#header {
background-color: #1564B3;
color: #fff;
height: 70px;
position: fixed;
width: 100%;
top: 0%;
left: 0%;
}
#header-a {
width: 100px;
background-color: #555555;
display: inline-block;
text-align: center;
margin-top: 0px;
height: 100%;
}
#header-h {
display: inline-block;
margin-top: 20px;
}
<div id="header">
<h2 id="header-h">Header text</h2>
<div id="header-a">
Home
</div>
</div>
You can reset the vertical-align(defaut is baseline) value on inline-block elements whenever needed. here vertical-align:top; will do fine :
#header {
background-color: #1564B3;
color: #fff;
height: 70px;
position: fixed;
width: 100%;
top: 0%;
left: 0%;
}
#header-a {
width: 100px;
background-color: #555555;
display: inline-block;
text-align: center;
margin-top: 0px;
height: 100%;
vertical-align:top;
}
#header-h {
display: inline-block;
margin-top: 20px;
}
<div id="header">
<h2 id="header-h">Header text</h2>
<div id="header-a">
Home
</div>
</div>
For a to cover the div, you may also use height or eventually line-height:
#header {
background-color: #1564B3;
color: #fff;
height: 70px;
position: fixed;
width: 100%;
top: 0%;
left: 0%;
}
#header-a {
width: 100px;
background-color: #555555;
display: inline-block;
text-align: center;
margin-top: 0px;
height: 100%;
vertical-align:top;
}
#header-a a {
display:block;
line-height:70px;/* will size it up to 70px height for each line */
}
#header-h {
display: inline-block;
margin-top: 20px;
}
<div id="header">
<h2 id="header-h">Header text</h2>
<div id="header-a">
Home
</div>
</div>
I changed it to this code. What I did was to change the display to block (in both header-a and header-h) instead of inline-block. I then floated both elements left. Run the snippet to see it in action
#header {
background-color: #1564B3;
color: #fff;
height: 70px;
position: fixed;
width: 100%;
top: 0%;
left: 0%;
}
#header-a {
width: 100px;
background-color: #555555;
text-align: center;
margin-top: 0px;
height: 100%;
}
#header-h {
margin-top: 20px;
}
#header-h,
#header-a {
display: block;
float: left;
}
<div id="header">
<h2 id="header-h">Header text</h2>
<div id="header-a">
Home
</div>
</div>
Rather than setting the height of your menu bar to 70px, you could let the contents within the menu bar size its height. That way you can vertically centre the Home button. JSFiddle
HTML
<div id="header">
<h2 id="header-h">Header text</h2>
<div id="header-a">
Home
</div>
</div>
CSS
#header {
position: fixed;
background-color: #1564B3;
color: #fff;
width: 100%;
top: 0%;
left: 0%;
}
#header-a {
background-color: #555555;
display:inline-block;
padding:30px 50px 30px 50px;
width:10%;
text-align:center;
}
#header-h {
display:inline-block;
width:30%;
text-align:center;
}
Do you see how the padding of #header-a not only vertically centres the Home text but also how the #header sizes to fit it.
So my website is www.jacobweyer.com
When the window becomes a certain small size, it creates a large gray area on the right side, where the header and footer wont expand to cover. How do I get rid of the large content less area while still leaving a small buffer area? I'm also having an issue where I want to have my social media buttons as far right as possible, however I want it to still stay as far right as possible until it would possibly overlap the title.
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Alpha Tau Omega | Theta Omega</title>
<link rel="stylesheet" type="text/css" href="ATOStyle.css" />
<link href='http://fonts.googleapis.com/css?family=Quattrocento+Sans' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="header">
<div id="innerheader">
<div id="banner">
</div><!-- End banner-->
<div id="title">
</div> <!--End title -->
<div id="navbar">
<ul>
<li>Home</li>
<li>Rush</li>
<li>History</li>
<li>Alumni</li>
<li>Calendar</li>
<li>Media</li>
</ul>
</div> <!--End navbar -->
</div><!-- End innerheader -->
<div id="outersocial">
<div id="social">
<ul>
<li>
<img src="./pieces/socialmedia/facebook.png" />
</li>
<li>
<img src="./pieces/socialmedia/twitter.png" />
</li>
<li>
<img src="./pieces/socialmedia/youtube.png" />
</li>
</ul>
</div> <!-- End social-->
</div> <!--End outersocial -->
</div> <!-- End header -->
<div id="pagecenter">
</div> <!-- End pagecenter -->
<div id="footer">
<div id="footercontent">
<div id="footerbanner1">
</div> <!--end footerbanner1-->
<div id="footernav">
<p> Alpha Tau Omega Fraternity | Theta Omega Chapter | Northern Kentucky University | Contact Us!</p>
</div> <!-- End footernav-->
<div id="footerbanner2">
</div> <!-- End footerbanner2-->
</div> <!--end footercontent -->
</div> <!--end footer-->
</body>
</html>
CSS
body {
height: 100%;
width: 100%;
margin: 0px 0px 0px 0px;
background-color: #808080
}
/* Header Container */
#header {
background:url(./pieces/headerBar.png);
position: static;
width:100%;
height:139px;
padding:0;
z-index: 10000;
}
/* Container inside the header for sorting elements */
#innerheader {
height: 139px;
width: 750px;
margin-right: auto;
margin-left: auto;
position: relative;
}
/* The following is the Nav Bar */
#navbar {
position: relative;
top: 76px;
left: 210px;
margin-left: inherit;
}
#navbar ul {
list-style-type: none;
margin: 0px;
padding: 0px;
}
#navbar ul li {
font-family: Arial, Helvetica, sans-serif;
text-decoration: none;
color: #000000;
display: inline-block;
width: 50px;
height: 20px;
margin: 10px;
}
#navbar ul li a {
text-decoration: none;
color: black;
}
#navbar ul li a:hover {
color: white;
}
/*The following is the Intertwine Banner */
#banner {
background:url(./pieces/banner.png);
position: absolute;
margin-left: 0px;
min-height: 193px;
min-width: 183px;
background-repeat: no-repeat;
}
/* Alpha Tau Omega - Theta Omega Title */
#title {
position: absolute;
background: url(./pieces/name.png);
margin-left: 190px;
min-height: 75px;
min-width: 285px;
}
/* The following are the social media icons */
#outersocial{
position:;
left:50%;
height: 139px;
width:50%;
}
#social {
position: absolute;
top: 2px;
right: 10px;
}
#social ul {
list-style-type: none;
}
#social li{
display: inline-block;
width: 36px;
height: auto;
margin: 5px;
}
#social img {
width: 36px;
height: auto;
}
/* Pagecenter is where the content will be on the web page*/
#pagecenter {
position: static;
margin-right: auto;
margin-left: auto;
height: 50px;
width: 750px;
min-height: 1000px;
background:url(./pieces/mainBG.png);
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
margin-top: -19px;
z-index:50
}
/* The following is the footer and its content */
#footer {
margin-top: 20px;
padding-top: 30px;
background: url(./pieces/footerbar.png);
height: 77px;
width: 100%;
margin-right: auto;
margin-left: auto;
clear: both;
bottom: 0px;
position: static;
}
#footerbanner1 {
background: url(./pieces/footerbanner.png);
position: absolute;
min-height: 95px;
min-width: 90px;
background-repeat: no-repeat;
margin-top: -30px;
left: 10px;
}
#footerbanner2 {
background: url(./pieces/footerbanner.png);
position: absolute;
min-height: 95px;
min-width: 90px;
background-repeat: no-repeat;
margin-top: -30px;
right: 10px;
}
#footercontent {
width: 100%;
height: 100%;
right: 5px;
left: 5px;
}
#footernav {
font-family: 'Quattrocento Sans', sans-serif;
position: absolute;
text-align: center;
right: 15%;
left: 15%;
}
#footernav p {
margin: 0px;
padding-right: 25%;
padding-left: 25%;
font-family: 'Quattrocento Sans', sans-serif;
color: white;
position: relative;
}
#footernav a {
font-family: 'Quattrocento Sans', sans-serif;
color: white;
}
#footernav a:hover {
color: orange;
}
An object is just a special kind of data, with properties and methods.
Object properties can be any of the three primitive data types, or any of the abstract data types, such as another object. Object properties are usually variables that are used internally in the object's methods, but can also be globally visible variables that are used throughout the page.
The syntax for adding a property to an object is:
objectName.objectProperty = propertyValue;
Example1. :
person=new Object();
person.firstname="stack";
person.lastname="overflow";
person.age=50;
person.color="black";
Example2 :
var message="Hello India!";
var x=message.length;
here .length is the property of object message.
I hope it will be helpful to you.
I've got a small problem, I want my footer to stay at the bottom of the screen with position: absolute. But my margin: auto to put it in the middle of the screen isn't working anymore.
html:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='Type=text/html; charset=utf-8'>
<link rel="shortcut icon" href="../IMAGES/favicon.ico">
<title>TEST</title>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="../css/stylesheet.css">
</head>
<body>
<div id="header">
<div id="logo">
<img src="../IMAGES/logo.png" />
</div>
<div id="logotitel">
Den Allerstrafste "Ful-Ambi" Live-Band van groot Antwerpen en omstreken!
</div>
</div>
<div id="nav">
<div id="links">
<div class="link">Home</div>
<div class="link">Wie is wie</div>
<div class="link">Foto's</div>
<div class="link">Repertoire</div>
<div class="link">Links</div>
<div class="link">Contact</div>
</div>
</div>
<div class="clear"></div>
<div id="content">
TEST
</div>
<div class="clear"></div>
<div id="footer">
<div id="copy">
Developed by Yoshi © vAntstAd
</div>
</div>
</body>
</html>
CSS:
/* PAGE LAYOUT */
html
{
padding: 0px;
margin: 0px;
}
body
{
background-image: url(../IMAGES/background.png);
padding: 0px;
margin: 0px;
color: white;
font-family: 'Source Sans Pro', serif, sans-serif;
}
.clear
{
clear: both;
}
/* HEADER */
#header
{
width: 1100px;
height: 150px;
background-color: #282828;
margin: auto;
border-bottom: solid;
border-color: red;
}
#logo
{
width: 283px;
height: 100px;
margin: auto;
}
#logotitel
{
width: 1100px;
height: 50px;
line-height: 50px;
text-align: center;
font-size: x-large;
}
/* NAV */
#nav
{
width: 1100px;
height: 50px;
margin-top: 25px;
margin-right: auto;
margin-left: auto;
margin-bottom: 25px;
background-color: red;
}
#links
{
width: 600px;
height: 50px;
margin: auto;
}
.link
{
width: 100px;
height: 50px;
line-height: 50px;
float: left;
text-align: center;
color: white;
text-decoration: none;
}
.link:hover
{
color: #282828;
text-decoration: underline;
}
/* CONTENT */
#content
{
width: 1100px;
height: auto;
margin: auto;
color: #282828;
position: relative;
}
/* FOOTER */
#footer
{
width: 1100PX;
height: 50px;
position: absolute;
bottom: 0;
margin: auto;
background-color: #282828;
}
#copy
{
width: auto;
float: right;
margin-right: 5px;
height: 50px;
line-height: 50px;
}
Since you know the width of the footer (1100px), you can just do a left:50%;margin-left:-550px to center it.
Example: Centering an absolutely positioned element
http://jsfiddle.net/vdWQG/
Therefore, footer would become:
#footer
{
width: 1100PX;
height: 50px;
position: absolute;
bottom: 0;
left:50%; /* Add this */
margin-left:-550px; /* Add this (this is half of #footers width) */
background-color: #282828;
}
If you want the element to stick on the bottom of the page as the user scrolls down, use position: fixed instead of position:absolute
To have a footer at the bottom, centered horizontally, you can apply the following CSS:
footer{
width: 100%;
max-width: 600px;
position: fixed;
left: 0;
right: 0;
bottom: 0;
margin: 0 auto;
}
This will center the fixed element, but will also keep it responsive, as it will shrink when the browser has become less wide than the footer.
See this Fiddle for an example