I accidentally put an extra close curly bracket - html

I am stuck with an extra close curry bracket in CSS that I accidentally put prior writing other lines. If I leave it there, it acually does no harm to the result. However, when I remove it, the position of other elements are repositioned.
(( In lines of code, the extra close curly bracket is where the arrow pointing ))
Please click on the links below to see both results.
Question: Is there any way to remove it without repositioning other elements?
Without the Close Curly Bracket
With the Close Curly Bracket
body{
font: 15px/1.5 Helvetica, Arial, sans-serif;
padding: 0;
margin: 0;
p(color#282f38);
background-color: #F5F2ED;
font:696863;
}
/*Global*/
.container{
width:80%;
margin:auto;
overflow:hidden;
}
ul{
margin:0;
padding:0;
}
/* Header */
#fixed{
position: fixed;
}
header{
position: fixed;
width: 100%;
background:#282f38;
color:#F5F2ED;
padding-top: 10px;
min-height:50px;
border-bottom:#F5F2ED 3px solid;
}
header a{
color:#F5F2ED;
text-decoration:none;
text-transform:uppercase;
font-size: 18px;
}
header li{
float:left;
display: inline;
padding: 0 20px 0 20px;
}
header #resume{
float: left;
}
header #resume h1{
margin: 0;
padding: 0;
}
header nav{
position: relative;
left: 30%;
float: right;
margin-top: 10px;
}
header .highlight, header .current a{
color:#696863 ;
font-weight: bold;
}
header a:hover{
color:#696863;
font-weight: bold;
}
/* Showcase */
#showcase {
min-height: 350px;
background: url('../Resources/Photographer.png') no-repeat 0 -120px;
align-items: center;
color: #ffffff;
overflow: auto;
}
#showcase h1{
text-align: center;
margin-top: 100px;
font-size: 40px;
margin-bottom: 10px;
}
#showcase p{
text-align:justify;
margin:0;
padding:0;
font-size: 14;
text-indent: inherit;
}
/* Social Medias*/
#socialmedias{
position:fixed;
padding-top: : 5px;
right: 20px;
top: 130px;
display: block;
vertical-align: baseline;
font: inherit;
list-style-type: none;
}
} <<-----------------------------------------------------------------------
/* Message Me Box */
#box{
width: 30%;
overflow: hidden;
padding: 1px;
}
/* Box Border */
.fieldset{
display: inline-block;
border: 3px solid;
float: right;
}
/* Message Me Title */
#legend{
font-size: 20px;
font-weight: bold;
color:#282f38;
}
/* Name Input */
#form-name{
display: block;
width: 200px;
margin-bottom: 10px;
}
/* Email Input */
#form-email{
display: block;
width: 200px;
margin-bottom: 10px;
}
/* Message Input */
#form-message{
display: block;
margin-bottom: 10px;
}
/* Contact */
.button_contact{
position: relative;
height: 30px;
width: 100%;
background:#696863;
color: #F5F2ED;
font-size: 14px;
text-transform: uppercase;
border: 0;
}

The extra curly bracket is being treated as part of the selector for the next rule. i.e. the rule is
} #box {
width: 30%;
overflow: hidden;
padding: 1px;
}
So } #box matches nothing. When you remove the }, the selector is #box and matches the element with id "box".
If you don't want the effect you get when removing the extra }, remove the entire rule.

Not just one error,
Check the comments I added in your code.
Best way to avoid these errors are using an IDE.
There are so many open source tools available. For example NetBeans.
They can help you to identify your errors.
Check this screenshot, they are easy to use also.
/* Social Medias*/
#socialmedias{
position:fixed;
padding-top: : 5px; // Error 1,
right: 20px;
top: 130px;
display: block;
vertical-align: baseline;
font: inherit;
list-style-type: none;
}
} // Error 2
body{
font: 15px/1.5 Helvetica, Arial, sans-serif;
padding: 0;
margin: 0;
p(color#282f38); // Error 3
background-color: #F5F2ED;
font:696863;
}

You have many errors in your css. I've validated your css on W3C CSS Validator
I've changed your CSS. See below:
body {
font: 15px/1.5 Helvetica, Arial, sans-serif;
padding: 0;
margin: 0;
background-color: #F5F2ED;
}
p {
color: #282f38;
}
/*Global*/
.container {
width: 80%;
margin: auto;
overflow: hidden;
}
ul {
margin: 0;
padding: 0;
}
/* Header */
#fixed {
position: fixed;
}
header {
position: fixed;
width: 100%;
background: #282f38;
color: #F5F2ED;
padding-top: 10px;
min-height: 50px;
border-bottom: #F5F2ED 3px solid;
}
header a {
color: #F5F2ED;
text-decoration: none;
text-transform: uppercase;
font-size: 18px;
}
header li {
float: left;
display: inline;
padding: 0 20px 0 20px;
}
header #resume {
float: left;
}
header #resume h1 {
margin: 0;
padding: 0;
}
header nav {
position: relative;
left: 30%;
float: right;
margin-top: 10px;
}
header .highlight, header .current a {
color: #696863;
font-weight: bold;
}
header a:hover {
color: #696863;
font-weight: bold;
}
/* Showcase */
#showcase {
min-height: 350px;
background: url('../Resources/Photographer.png') no-repeat 0 -120px;
align-items: center;
color: #ffffff;
overflow: auto;
}
#showcase h1 {
text-align: center;
margin-top: 100px;
font-size: 40px;
margin-bottom: 10px;
}
#showcase p {
text-align: justify;
margin: 0;
padding: 0;
font-size: 14px;
text-indent: inherit;
}
/* Social Medias*/
#socialmedias {
position: fixed;
padding-top: 5px;
right: 20px;
top: 130px;
display: block;
vertical-align: baseline;
font: inherit;
list-style-type: none;
}
/* Message Me Box */
#box {
width: 30%;
overflow: hidden;
padding: 1px;
}
/* Box Border */
.fieldset {
display: inline-block;
border: 3px solid;
float: right;
}
/* Message Me Title */
#legend {
font-size: 20px;
font-weight: bold;
color: #282f38;
}
/* Name Input */
#form-name {
display: block;
width: 200px;
margin-bottom: 10px;
}
/* Email Input */
#form-email {
display: block;
width: 200px;
margin-bottom: 10px;
}
/* Message Input */
#form-message {
display: block;
margin-bottom: 10px;
}
/* Contact */
.button_contact {
position: relative;
height: 30px;
width: 100%;
background: #696863;
color: #F5F2ED;
font-size: 14px;
text-transform: uppercase;
border: 0;
}

/* Header */
----------------->#fixed{<------------------
position: fixed;
}
Try to change the id where the arrow is pointed, use class for that, because there are so many conflicts, if we use IDs directly. For more information please find the link below:
https://github.com/CSSLint/csslint/wiki/disallow-ids-in-selectors

i think there is something to do with "#fixed" id name in the html and css.
try to change the name to something else. The property and your name might be colliding with each other. So change it...

Related

My page seems to have right padding or margin when scaled further down?

My site is fine until I go lower than 723px wide then a white margin appears on the right side of all of my background colors. I have tried to go in and delete margins and padding to see where I have gone wrong. I also played with the width of the elements and it just stretches the image over the visible portion when I set the image to full. I've inspected the page and can not define the white space on the page and where it comes from.
I also tried adding display:inline-block; to my css background divs as well as setting the width: 100%.
CSS
body {
margin: 0;
font-family: 'Comic Neue', sans-serif;
}
main {
margin-top: none;
}
.hero_image {
background-image: url("C:/Users/Kascey.Malone/Documents/Websites/Midterm/images/669.png");
height: 100vh;
width: 100%;
position: relative;
background-size: 100% 100%;
display:inline-block;
}
/*NAVIGATION BAR*/
header {
height: fit-content;
}
header a {
font-weight: bold;
color: #FCD90A;
}
header a:link {
text-decoration: none;
}
header a:visited {
text-decoration: none;
}
header a:hover {
text-decoration: underline;
}
header a:active {
text-decoration: underline;
}
.topnav {
overflow: hidden;
text-decoration: none;
}
.left {
padding: 20px;
float: left;
width: 50%;
box-sizing: border-box;
text-decoration: none;
text-align: left;
}
.right {
padding: 20px;
float: right;
width: 50%;
box-sizing: border-box;
text-decoration: none;
text-align: right;
}
/*HERO BOX*/
.hero {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%);
}
.hero h1 {
font-size: 15vw;
margin: 0;
text-align: center;
color: #9A1000;
font-style: italic;
}
.hero button {
padding: 1em;
margin-top: 10vh;
background-color: #FCD90A;
white-space: nowrap;
font-size: 1vw;
font-family: 'Comic Neue', sans-serif;
}
.hero button a{
text-decoration: none;
color: black;
}
.hero button a:link {
text-decoration: none;
}
.hero button a:visited {
text-decoration: none;
}
.hero button a:hover {
font-weight: bold;
}
.hero button a:active {
font-weight: bold;
}
.container {
position: relative;
}
.center {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
/*MENU TABLE*/
.table {
background-color: white;
padding-top: 100px;
padding-bottom: 100px;
box-sizing:border-box;
}
table {
margin-left: auto;
margin-right: auto;
padding: 40px;
font-size: 1vw;
background-color: white;
border: solid 8px black;
box-sizing:border-box;
}/*Add border.*/
thead {
text-align: right;
}
td:nth-child(even) {
text-align: left;
padding-left: 100px;
}
td:nth-child(odd) {
text-align: right;
padding: 10px;
}
.row {
display: flex;
margin: 0 auto;
}
table a{
text-decoration: none;
color: black;
} /*Change color based off background*/
table a:link {
text-decoration: none;
}
table a:visited {
text-decoration: none;
}
table a:hover {
text-decoration: underline;
}
table a:active {
text-decoration: underline;
}
th {
padding: 10px;
}
/*ABOUT TEXT*/
.about {
height: auto;
padding-top: 5vh;
padding-bottom: 5vh;
background-color: #3823FC;
background-size: 100% 100%;
}
.column {
flex: 50%;
padding: 10px;
}
.column h2{
font-size: 2vw;
padding-left: 200px;
color: white;
}
.column p{
padding-right: 200px;
padding-top: 88px;
font-size: 1.5vw;
color: white;
}
.column img {
width: 30vw;
padding-left: 200px;
height: auto;
}
/*FOOTER*/
.footer {
background-color: #0C026C;
padding: 10px;
text-align: left;
color: white;
}
Try to use percentages for your padding/margins. Your size is scaling based on screen size with the percentages used.
Another option could be using display: flex; with flex containers.
Here is a helpful document to get you started.
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
You could also use #Media tags in CSS for different screen sizes to fit things manually. Here is a reference to get you started: W3 Schools Reference

Website Pulls Correct Fonts Only When Clicking Certain Links, Will Otherwise Pull From System Fonts

I'm having the problem described in the post title with my portfolio website, and I'm really at a loss as to what the problem could be. The "Work" and "Contact" pages won't pull the correct fonts even if I navigate to them using my dropdown links, and individual project pages only pull the proper fonts if I navigate to one of the projects from the home page (after clicking the logo on the top left to get the fonts to load at all), and then use previous and next buttons at the end of each project. I've checked all references to files within folders, and everything seems to be in order. The site's URL is mtbailey.com, and I've attached a screenshot of what things should look like if everything works the way it's supposed. Does anyone have any idea what's going on?
https://gyazo.com/d478ce4471e5944eae44af5fcef3c281
CSS:
#font-face {
font-family: 'Spartan MB';
font-style: normal;
font-weight: 400;
src: url("../fonts/SpartanMB/SpartanMB-Regular.eot"); /* IE9 Compat Modes */
src: url("../fonts/SpartanMB/SpartanMB-Regular.eot?#iefix") format('embedded-opentype'), /* IE6-IE8 */
url("../fonts/SpartanMB/SpartanMB-Regular.woff") format('woff'), /* Modern Browsers */
url("../fonts/SpartanMB/SpartanMB-Regular.woff2") format('woff2'), /* Modern Browsers */
url("../fonts/SpartanMB/SpartanMB-Regular.ttf") format('truetype'); /* Safari, Android, iOS */
text-rendering: optimizeLegibility;
}
#font-face {
font-family: 'Spartan MB';
font-style: normal;
font-weight: 600;
src: url('../fonts/SpartanMB/SpartanMB-SemiBold.eot'); /* IE9 Compat Modes */
src: url('../fonts/SpartanMB/SpartanMB-SemiBold.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('../fonts/SpartanMB/SpartanMB-SemiBold.woff') format('woff'), /* Modern Browsers */
url('../fonts/SpartanMB/SpartanMB-SemiBold.woff2') format('woff2'), /* Modern Browsers */
url('../fonts/SpartanMB/SpartanMB-SemiBold.ttf') format('truetype'); /* Safari, Android, iOS */
text-rendering: optimizeLegibility;
}
#font-face {
font-family: 'Spartan MB';
font-style: normal;
font-weight: 900;
src: url('../fonts/SpartanMB/SpartanMB-ExtraBold.eot'); /* IE9 Compat Modes */
src: url('../fonts/SpartanMB/SpartanMB-ExtraBold.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('../fonts/SpartanMB/SpartanMB-ExtraBold.woff') format('woff'), /* Modern Browsers */
url('../fonts/SpartanMB/SpartanMB-ExtraBold.woff2') format('woff2'), /* Modern Browsers */
url('../fonts/SpartanMB/SpartanMB-ExtraBold.ttf') format('truetype'); /* Safari, Android, iOS */
text-rendering: optimizeLegibility;
}
strong {
font-weight: 600;
}
html, body {
max-width: 100%;
overflow-x: hidden;
font-kerning: normal;
-webkit-font-kerning: normal;
margin: 0;
font-family: 'Spartan MB';
}
li {
list-style: none;
display: inline;
}
a {
text-decoration: none;
color: inherit;
}
p {
text-decoration: none;
font-weight: 400;
font-size: 1em;
}
hr {
background-color: #293941;
border-style: solid;
border-width: 1.2px;
float: left
width: 100%;
}
h1 {
text-decoration: none;
font-weight: 900;
font-size: 8vw;
-webkit-margin-after: 0;
-webkit-margin-before: 0;
}
h2 {
text-decoration: none;
font-weight: 900;
font-size: 4vw;
-webkit-margin-after: 0;
-webkit-margin-before: 0;
}
h3 {
text-decoration: none;
font-weight: 900;
font-size: 1.5em;
-webkit-margin-after: 0;
-webkit-margin-before: 0;
}
input[type=text] {
border-bottom: 2px solid #293941;
padding: 3px 0px;
font-family: Spartan MB;
font-size: 1em;
width: 100%;
max-width: 600px;
margin: 5px 0px 5px 0px;
}
input[type=submit] {
padding: 10px;
font-family: Spartan MB;
background-color: #25bcbd;
font-weight: 900;
color: white;
font-size: 1.35em;
cursor: pointer;
}
textarea {
border-bottom: 2px solid #293941;
border-top: none;
border-left: none;
border-left: none;
border-right: none;
width: 100%;
max-width: 600px;
height: 200px;
font-family: Spartan MB;
font-size: 1em;
padding: 3px 0px;
margin: 5px 0px 5px 0px;
}
.teal {
color: #25bcbd;
}
.blue {
color: #2F90BB;
}
.mobileimg {
display: block;
}
.desktopimg {
display: none;
}
.footnote{
font-size: 0.6em;
margin: 0.6em 0 0 1 em;
}
#wrap {
margin-top: 80px; /*Same as Header height*/
margin-left: auto;
margin-right: auto;
max-width: 600px;
position: relative;
color: #293941;
padding: 0 1vw;
}
#header {
width: 100%;
height: 82px;
background-color: #FFFFFF;
position: fixed;
top: 0px;
left: 0px;
z-index: 2;
}
#headerwrap {
margin-left: auto;
margin-right: auto;
max-width: 600px;
position: relative;
color: #293941;
padding: 0 1vw;
height: 82px;
background-color: white;
}
.mobileheaderbar {
width: 100%;
height: 2px;
background-color: #293941;
float: left;
}
#header img {
width: 100%;
height: auto;
}
#logo {
width: 160px;
height: 100px;
float: left;
display: none;
}
#dhr {
height: 3px;
width: 100%;
border-top: 2px solid #293941;
border-bottom: 2px solid #293941;
float: left;
}
#squarelogo {
width: 45px;
height: auto;
float: left;
margin-left: 10px;
}
#nav {
display: none;
float: right;
font-weight: 900;
font-size: 23px;
padding-top: 30px;
width: 20%;
}
#nav a {
color: #293941;
display: inline;
float: left;
}
input, button, submit {
border: none;
padding: 0px;
}
.dropbtn {
border: none;
cursor: pointer;
width: 60px;
height: 80px;
background-image: url("../images/hamburger.svg");
background-size: cover;
background-color: white;
}
.dropdown {
position: relative;
display: inline-block;
float: right;
}
.dropdown-content {
display: none;
position: absolute;
background-color: white;
min-width: 160px;
overflow: auto;
right: 0px;
font-family: 'Spartan MB';
font-weight: 900;
}
.dropdown-content a {
padding: 12px 16px;
text-decoration: none;
display: block;
color: #293941;
border-bottom: 1px solid #293941;
}
.dropdown a:hover {background-color: #e5e5e5}
.show {display:block;}
#landing {
width: 100%;
position: relative;
border-bottom: 2px solid #293941;
display: block;
float: left;
}
#lndmain {
width: 100%;
clear: both;
float: left;
}
#lndside {
width: 100%;
clear: both;
float: left;
line-height: 2;
padding-bottom: 25px;
}
#lndmain h1{
font-size: 3em;
padding-top: 25px;
}
#lndmain h2{
font-size: 1em;
font-weight: 400;
padding-bottom: 25px;
}
#lndside h1 {
font-weight: 400;
font-size: 1em;
}
.projlogo {
width: 100%;
float: left;
}
.projdesc {
float: left;
padding-bottom: 3.4%;
}
.projdesc p {
margin: 0;
}
.projdesc h1 {
line-height: 1.2;
margin-top: 3%;
}
.twocolumn {
-webkit-columns: 1 0px;
-moz-columns: 1 0px;
columns: 1 0px;
float: left;
}
.thumb {
float: left;
margin: 3.4% 0px;
-webkit-column-break-inside: avoid;
page-break-inside: avoid;
break-inside: avoid;
}
.thumb h1 {
line-height: 1;
margin-top: 3%;
}
.more {
font-size: 5vw;
font-weight: 900;
}
.prevnext {
font-size: 5vw;
font-weight: 900;
display: inline;
}
.fade:hover {
opacity: 0.5;
}
.arrow {
width: 1.75vw;
height: auto;
}
#portfoliowrap {
width: 100%;
-webkit-columns: 2 550px;
-moz-columns: 2 550px;
columns: 2 550px;
-webkit-column-gap: 1.5em;
-moz-column-gap: 1.5em;
column-gap: 1.5em;
}
#wrap img {
max-width: 100%;
height: auto;
}
.portfolioimg {
width: 100%;
max-width: 600px;
margin-top: .75vw;
margin-bottom: .75vw;
-webkit-column-break-inside: avoid;
page-break-inside: avoid;
break-inside: avoid;
display: inline-block;
position: relative;
}
.overlay {
position: absolute;
height: 100%;
width: 100%;
display: none;
background-image: url(../images/trans.png);
}
.overlaytext {
position: absolute;
bottom: 0;
padding: 15px;
color: white;
}
.footerbox {
float: left;
display: inline;
margin: 20px 0px 30px 0px;
}
.h_iframe {
position:relative;
clear:both;
}
.h_iframe .ratio {
display:block;
width:100%;
height:auto;
}
.h_iframe iframe {
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
}
#contactform {
padding-top: 3.4%;
}
.h_iframe {
position:relative;
clear:both;
}
.h_iframe .ratio {
display:block;
width:100%;
height:auto;
}
.h_iframe iframe {
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
}
#media screen and (min-width: 1200px) {
#wrap {
max-width: 1200px;
padding: 0 0;
}
#header {
height: 100 px;
}
#headerwrap {
max-width: 1200px;
padding: 0 0;
height: 100px;
border-bottom: 2px solid #293941;
}
.mobileimg {
display: none;
}
.desktopimg {
display: block;
}
.mobileheaderbar {
display: block;
}
p {
font-size: 19px;
}
h1 {
font-size: 3.25em;
}
h2 {
font-size: 2.5em;
}
h3 {
font-size: 1.75em;
}
.footnote {
font-size: 14px;
}
#nav {
display: inline-block;
}
#logo {
display: inline;
}
#logo img {
height: 100px;
}
#squarelogo {
display: none;
}
#landing {
margin-top: 20px;
}
#lndmain {
width: 74.9%;
/*Not an even 75% to account for lndmain border-right*/
border-right: 2px solid #293941;
}
#lndside {
width: 20%;
/*Not an even 25% to account for lndmain border-right*/
clear: none;
box-sizing: border-box;
margin: 0 0 152px 4.9%;
position: absolute;
right: 0;
bottom: 0;
}
#lndmain h1{
font-size: 8em;
padding-top: 100px;
}
#lndmain h2{
font-size: 3em;
padding-bottom: 100px;
}
#lndside h1{
font-size: 1.3em;
}
.projlogo {
width: 25%;
border-right: 2px solid #293941;
padding: 2.5% 5% 2.5% 0px;
}
.projdesc {
width: 64%;
padding: 4.75% 0px 0px 5%;
/*Not an even 65% to account for projlogo border-right*/
}
.dropbtn {
display: none;
}
#nav a:nth-of-type(even){
float: right;
text-align: right;
}
/*This floats "Contact" to the right on desktop by floating only even numbered nav links to the right*/
.twocolumn {
-webkit-columns: 2 590px;
-moz-columns: 2 590px;
columns: 2 590px;
-webkit-column-gap: 20px;
-moz-column-gap: 20px;
column-gap: 20px;
}
.thumb {
height: 625px;
position: relative;
}
.more {
font-size: 2em;
position: absolute;
bottom: 0px;
}
.prevnext {
font-size: 2em;
}
.arrow {
width: 11px;
}
}
htaccess
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule ^(.*)$ $1.html Header add Access-Control-Allow-Origin "*"
Sorry for the extended comments section, I try not to reach out on this site to avoid being a bother, and I see that I've had the opposite effect in flooding the comments.
It seems like things have sorted themselves out whether using www or not, but it'll probably still be a good idea to update my htaccess to force non-www.

Can't get my Aside element to format properly

I am unable to get my aside element to align properly with the rest of my page. It sits above the main element and spills into the header. How do I fix that?
Here's what it looks like on the page:
Here's the CSS Style code I'm using:
* {
margin:0;
padding:0;
}
body {
font-size:1.1em;
font-family: Arial, Helvetica, sans-serif;
background-color:darkseagreen;
}
header {
padding: 1%;
margin-bottom: 3%;
text-align: center;
font-size:2em;
font-family: Arial, Helvetica, sans-serif;
text: white;
background-color: #4EEE94;
}
aside {
width: 25%;
padding: 0.5%;
margin: 0 5px 5px 0;
background-color: #1C86EE;
float: right;
border-radius: 20px;
position: relative;
min-height: 100%;
display: block;
}
#main {
width: 446px;
margin-right: 27%;
padding: 0.5%;
background-color: #EE6363;
text: white;
position: relative;
border-radius: 4%;
}
.map {
padding: 2em;
margin: 3em auto 3em auto;
position: relative;
display: block;
text-align: center;
width: 95%;
.image {
padding: 5%;
margin: 4em;
float: left;
position: relative;
left: 10px;
top: 15px;
}
}
div {
box-shadow: 10px 10px 5px #888888;
border: 2px solid;
border-radius: 25px;
}
nav ul li {
margin-right: 1em;
display: inline;
list-style-type: none;
}
nav li a {
padding: 1em;
color: white;
text-decoration: none;
}
nav li a:hover {
color: yellow;
text-decoration: underline;
}
footer {
margin: 0.5% 27% 0 0;
border-top: solid thick teal;
padding: 0.5%;
background-color: lime;
}
first issue with your css remove the braces after .image class.
.image {
padding: 5%;
margin: 4em;
float: left;
position: relative;
left: 10px;
top: 15px;
}
}
second thing use px or % or em do not use all (recommended) .
Third use id something like this
<div id="xyz"></div>
Not <div id="#xyz"></div> # is the css selector
also do not use multiple id like <div id="abc xyz"></div> u cannot use multiple id's use class instead of <div class="abc xyz"></div>

CSS div changes position on specific pages

I'm having a strange CSS problem where the main div container on my website shifts to the right when I visit certain pages. This happens even though there is no specific CSS rule to move it
I've uploaded a temp version of my site here:
http://myawesometestsite.ddns.net/
When you go to the Publications and Contact page the entire container shifts to the right by a few pixels. The position appears to be correct and unshifted on all other pages
This is the full CSS I'm using:
body {
background-color: #dcd8cf;
font-family: Raleway, Arial, sans-serif;
font-size: 1em;
}
h1 {
font-size: 1.5em;
color: #832C00;
margin-bottom: 30px;
}
h2 {
font-size: 1.2em;
color: #832C00;
margin-top: 30px;
}
h3 {
font-size: 1em;
margin-bottom: 5px;
margin-top: 20px;
}
h4 {
font-size: 1em;
font-style: italic;
margin-top: 0px;
margin-left: 10px;
margin-bottom: 5px;
}
.container {
position: relative;
left: 50%;
margin-left: -470px;
width: 940px;
border: 1px solid black;
}
/*
Header
*/
header {
position: relative;
display: inline-block;
width: 100%;
height: 180px;
background-color: #a63700;
}
header h1 {
position: absolute;
font-size: 2.5em;
color: #e6e6dc;
top: 50px;
left: 100px;
margin: 0px;
}
header h2 {
position: absolute;
font-size: 0.77em;
color: #e6e6dc;
top: 100px;
left: 100px;
margin: 0px;
opacity: 0.7;
}
header img {
border: 2px solid #e6e6dc;
border-radius: 50%;
max-width: 100%;
max-height: 100%;
}
.profileImage {
display: block;
margin-left: auto;
margin-right: auto;
margin-top: 10px;
max-width: 150px;
max-height: 150px;
}
.skillIcons {
position: absolute;
right: 25px;
top: 15px;
}
.skillIcons img {
display: inline;
width: 75px;
height: 75px;
padding: 5px;
margin: 15px;
opacity: 0.7;
}
/*
Navigation menu
*/
nav {
position: relative;
z-index: 1;
text-align: center;
letter-spacing: 2px;
background-color: #a63700;
height: 50px;
width: 100%;
}
nav a {
position: relative;
top: 20px;
color: #D1D1C9;
text-decoration: none;
padding: 0 30px;
}
nav a:hover {
border-bottom: solid 1px #e6e6dc;
padding-bottom: 3px;
}
.navSelected {
text-shadow:0px 0px 1px white;
color: white;
}
/*
Main content
*/
main {
position: relative;
background-color: white;
padding: 10px;
}
/*
Footer
*/
footer {
position: relative;
color: #e6e6dc;
background-color: #a63700;
font-size: 10pt;
padding: 10px;
}
.leftFooter ul {
padding-left: 0px;
}
.leftFooter li {
display: inline;
list-style-type: none;
}
.leftFooter li a {
color: #e6e6dc;
text-decoration: none;
}
.leftFooter li + li:before {
color: #e6e6dc;
content: "|";
padding: 10px;
}
.rightFooter {
position: absolute;
right: 10px;
top: 4px;
}
.rightFooter img {
display: inline;
max-width: 30px;
max-height: 30px;
vertical-align: middle;
margin-top: -3px;
}
.copyright {
font-size: 1em;
}
/*
Home page
*/
/*
Publications page
*/
.hangingIndent {
padding-left: 1.5em;
text-indent:-1.5em;
}
.publications h2 {
margin-top: 50px;
}
/*
Code page
*/
.codeProjects a {
color: #a63700;
text-decoration: none;
}
.codeProjects a:hover {
text-decoration: underline;
}
.codeProjects p {
margin-left: 10px;
}
/*
CV page
*/
.cvContainer {
width: 90%;
margin: 0 auto;
}
.cvEntry {
margin-bottom: 30px;
margin-left: 20px;
margin-right: 20px;
}
.sectionHeading {
width: 100%;
border-bottom: 1px solid #000;
}
.alignLeft {
display: block;
float: left;
text-align: left;
width: 80%;
margin-top: 10px;
}
.alignLeft p {
font-size: 1em;
}
.alignLeftSub {
margin-top: -10px;
margin-left: 20px;
}
.alignRight {
display: block;
float: right;
text-align: right;
width: 20%;
margin-top: 10px;
}
.clear {
clear: both;
}
/*
Contact page
*/
.contactInfo {
margin-left: 20px;
}
.contactInfo img {
display: inline;
max-width: 30px;
max-height: 30px;
vertical-align: middle;
}
.emailHidden {
display: none;
}
.contactInfo a {
margin-left: 5px;
color: #a63700;
text-decoration: none;
}
.contactInfo #emailAddress {
margin-left: 2px;
}
.contactInfo #emailAddress a {
margin-left: 8px;
}
/*
Media queries
*/
#media screen and (max-width : 940px) {
.container {
position: relative;
left: 0px;
margin: 0px;
width: 100%;
}
header h1 {
left: 5%;
margin: 0px;
}
header h2 {
left: 5%;
margin: 0px;
}
.skillIcons img {
max-width: 70px;
max-height: 70px;
margin-left: 5px;
margin-right: 0px;
}
}
#media screen and (max-width : 800px) {
header h1 {
display: none;
}
header h2 {
display: none;
}
.skillIcons img {
display: none;
}
nav {
height: 150px;
}
nav a {
display: block;
}
nav a:hover {
border-bottom: none;
padding-bottom: 0px;
}
}
#media screen and (max-width : 600px) {
.rightFooter {
position: relative;
display: block;
margin-left: 10px;
}
}
I don't believe there's anything in here that's causing the container to shift for just those 2 pages but maybe I'm missing something. Anyone have any idea whats causing this?
Add "overflow-y: scroll;" to your "body" selector. It should look like this in your CSS:
body {
background-color: #dcd8cf;
font-family: Raleway, Arial, sans-serif;
font-size: 1em;
overflow-y: scroll;
}
The lenght of the pages create a vertical scroll bar. Publication and contact are small then the other are more big then the screen. for fix this you need an overflow-y set to scroll;
body {
overflow-y: scroll;
}

CSS no background image, any ideas?

I'm trying to get my background image to show at the top center of the page. The image works fine if I do:
<style>
body {
background: #FFF url('img/top_logo_blank_small.png') no-repeat fixed;
}
</style>
I can't seem to work out where I've gone wrong. There must be something I've managed to mess up, I just can't see it. Here is the CSS:
body {
font-family: 'Quattrocento Sans', helvetica, sans-serif;
background: #EEE url('img/top_logo_blank_small.png') no-repeat fixed;
color: #fff;
margin: 0;
padding: 0;
}
a {
color: black;
text-decoration: none;
}
/* Typography */
.header h1 {
position: absolute;
width:100%;
top: 50%;
margin-top: -20px;
text-align: center;
letter-spacing: 4px;
}
.header h1 em {
font-size: 1.200em;
font-style: normal;
}
h1 {
font-size: 2.2em;
color: #fff;
}
.content h2 {
font-size: 1.75em;
color: #fff;
letter-spacing: 4px;
text-align: center;
}
.content h2 em {
font-size: 1.2em;
font-style: normal;
}
.content h3 {
text-align: center;
font-size: 1.0em;
font-weight: normal;
color: #ede0ed;
letter-spacing: 1px;
margin-bottom: 25px;
}
.content h4 {
margin-top: 0;
text-align: center;
font-size: 0.8em;
font-weight: normal;
color: #ede0ed;
letter-spacing: 1px;
}
#banner p {
text-align: center;
}
/* Navigation */
#nav {
margin: 4px 4px 40px;
}
#nav ul {
padding: 0;
margin: auto;
list-style: none;
}
#nav ul li {
width: 50%;
color: #BBB;
float: left;
font-family: 'Cabin Sketch';
font-size: 1.75em;
text-align: center;
background: url(img/scribble_dark.png);
}
#nav ul li a {
display: block;
/*padding: 5px 20px;*/
}
#nav ul li a:hover {
background: #e0d0e0;
}
/* Content */
.container{
max-width: 720px;
margin: 50px auto 0;
background: #FFF url('img/top_logo_blank_small.png') no-repeat fixed 0 0;
}
.header {
position: relative;
background-color: #b88fb8;
border-top: 5px solid #ede0ed;
height: 75px;
}
.content {
background-color: #000;
padding: 15px;
margin-bottom: 10px;
}
div#about {
padding:25px;
min-height: 255px;
}
img#portrait {
float: left;
margin-right: 25px;
width: 256px;
height: 256px;
}
div#footer {
width: 100%;
max-width: 720px;
margin: auto;
color: black;
text-align: right;
padding: 0 10px;
font-size: 0.850em;
}
#media screen and (max-width: 650px) {
.container {
width: 90%;
max-width: none;
}
div#footer {
width: 90%;
}
}
Try to change your path for example:
background: #EEE url('../img/top_logo_blank_small.png') no-repeat fixed top;
Because you are in a subfolder, you have to go up of a level I think
Most likely your css file is in a different folder and therefore needs another path to the image file.
The common way is to put css in a separate css/* folder, so the path should be:
url('../img/top_logo_blank_small.png')
This CSS seems to work fine, are you certain that the image exists?
http://jsfiddle.net/ghsNR/
I've just tried it here and it works fine with an image from http://placehold.it/
body {
font-family: 'Quattrocento Sans', helvetica, sans-serif;
background: #EEE url('http://placehold.it/500x500') no-repeat fixed top;
color: white;
margin: 0px;
padding: 0px;
}
The most likely cause after observing this is that your CSS isn't actually locating your image correctly. I suggest using tools like the Chrome dev tools, or Firebug to inspect the absolute path that the browser is trying to use to load the image and moving forward from there.
Is the css in the same folder as the page? If you have a different folders, you need to change the URL accordingly.
Maybe change the URL to
'../img/top_logo_blank_small.png'