Question

I cant for the life of me find out whats wrong with the CSS code, I cant get the font in main <p> to be 20px and can't properly center the address in the footer. I am only allowed to edit css file.

Html file: http://www.mediafire.com/view/68bcokhw6tb086g/redball.htm

CSS file: http://www.mediafire.com/view/9rk9dracsz47sn7/pizza.css

CSS code:

/*
New Perspectives on HTML and CSS
Tutorial 4
Case Problem 2

Pizza Style Sheet
Author: Joesph Aguilar
Date: 01/31/2014  

Filename:         pizza.css
Supporting Files: 

*/

 /* Display Block Elements */
header, section, aside, footer, nav{
 display: block;
}

/* Padding and Margin Style */
*{
 padding: 0px;
 margin: 0px;
 }

/* Body Style */
body{
 background-color: red;
 font-family: Verdana, Geneva, sans-serif;
}

/* Container Style */
#container{
 width: 1000px;
 margin-top: 0px;
 margin-bottom: 0px;
 margin-left: auto;
 margin-right: auto;
 border-left: 1px solid black;
 border-right: 1px solid black;
 background: white url('redbar.png') repeat-y left top;
}

/*Header Style */
header{
 background-color: white;
 height: 100px;
}

/* Horizontal Nav Style */
nav.horizontal{
 background-color: white;
 height: 70px;
 width: 100%;
}
nav.horizontal li{
 background-color: white;
 font-size: 16px;
 height: 50px;
 line-height: 50px;
 width: 180px;
 display: block;
 float: left;
 margin-left: 5px;
 margin-right: 5px;
 text-align: center;
}
nav.horizontal li a{
 display: block;
 background-color: red;
 color: white;
 border-radius: 30px / 25px;
 -moz-border-radius: 30px / 25px;
 -webkit-border-radius: 30px / 25px;
 text-decoration: none;
}
nav.horizontal li a:hover{
 background-color: (255, 101, 101);
 color: black;
}

/* Vertical Nav Style */
nav.vertical{
 clear: left;
 float: left;
 width: 200px;
}
 nav.vertical li{
 list-style-type: none;
 text-indent: 20px;
 margin-top: 20px;
 margin-bottom: 20px;
}
nav.vertical li a{
 color: white;
 text-decoration: none;
}
nav.vertical li a:hover{
 color: black;
}

/* Section Style */
#main{
 background-color: rgb(255, 211, 211);
 float: left;
 width: 600px;
}
#main > p {
 font-size: 20px;
 margin: 15px;
}
#main img{
 float: right;
 margin: 15px;
 width: 350px;
 border-bottom-left-radius: 350px;
 -moz-border-radius-bottomleft: 350px;
 -webkit-bottom-left-radius: 350px;
}

/* Coupon Style */
#main div.coupon{
 border: 5px;
 border-style: dashed;
 float: left;
 width: 170px;
 height: 150px;
 margin-top: 20px;
 margin-bottom: 20px;
 margin-left: 10px;
 margin-right: 10px;
 background: white url('slice.png') no-repeat right bottom;
}
#main div.coupon h1{
 color: white;
 background: rgb(192, 0, 0);
 font-size: 16px;
 letter-spacing: 2px;
 text-align: center;
 height: 25px;
 font-variant: small-caps;
}
#main div.coupon p{
 font-size: 14px;
 text-align: center;
 margin: 5px;
}

/* Aside Style */
aside{
 float: left;
 width: 200px;
}
aside h1{
 color: rgb(192, 0, 0);
 font-size: 20px;
 letter-spacing: 2px;
 font-weight: normal;
 text-align: center;
}
aside li{
 background-color: rgb(255, 135, 135);
 border-radius: 5px;
 list-style-type: none;
 margin: 10px;
 padding: 5px;
}

/*Footer Style*/
footer{
 clear: left;
 margin-left: 200px;
}
footer address{
 border-top-style: 1px solid red top;
 color: red;
 font-size: 10px;
 font-style: normal;
 text-align: center;
 margin-top: 25px;
 padding-bottom: 20px;
     }
Was it helpful?

Solution

The address is centered in the footer. Your problem is that you want the address centered on section#main, and the footer isn't in the section#main, it's in div#container, resulting in an address centered to the whole container.

However, since your aside has a static width of 200px, we can add that as a margin into footer>address, so that it centers the content accordingly.

So, we want on footer address is:

margin-right:200px;

but since we already have

margin-top:25px;

we can just delete that margin-top line and say both with:

margin:25px 200px 0 0;

which is shorthand for margin top 25px right 200px bottom 0 left 0.

Finally, the correct way to post this would be on JSFiddle, it's super easy to figure out, and I put my solution for your problem here:

http://jsfiddle.net/R8Hsv/

OTHER TIPS

All about your font size seems fine, at least I can change it. How do you expect 20px to be?

Had to set a width for your footer, to the same as the main.

footer address{
 border-top-style: 1px solid red top;
 color: red;
 font-size: 10px;
 font-style: normal;
 text-align: center;
 margin-top: 25px;
 padding-bottom: 20px;
 width:600px;
}

JSFIDDLE: http://jsfiddle.net/42h96/1/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top