Forum Moderators: not2easy

Message Too Old, No Replies

html to css: margins

         

sjaver

8:12 pm on Jul 13, 2010 (gmt 0)

10+ Year Member



Hi,

I have a validation error that I would like to fix (among many)
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional

My current code reads: <body leftmargin="1" topmargin="1" marginwidth=" "> in the template I use.

I want to change this and put it in my css file (where it belongs) but am unsure of the syntax - should it look like this:
body {
background-color:#321414;
font-family:Arial Unicode MS;
color:#E3BBBB;
font-size:14pt;
font-weight:normal;
margin-left:1;
margin-top:1;
marginwidth:100%;

}

I would appreciate help, as I am trying to clean up my code and make it compliant and am really not sure what I am doing. The site is www.thecontemporarycouch.com.

Thanks,
Sharon

Major_Payne

8:43 pm on Jul 13, 2010 (gmt 0)



When using CSS, you must add the dimensions:

margin-left:1px;
margin-top:1px;


Better:


body {
background: #321414;
font-family: 'Arial Unicode MS'; /* use single quotes */
color: #e3bbbb; /* try to use lowercase on properties */
/* font-size: 14pt; */
font-size: 1em; /* em is better for base font */
font-weight: normal;
margin: 1px 0 0 1px;
}



Delete this: marginwidth:100%; Not allowed.

To center the page, set a width less than 100% and use the CSS property: margin: 0 auto;

Then add margin-top: 1px; below that as you will not need left/right margins at this point.

sjaver

9:10 pm on Jul 13, 2010 (gmt 0)

10+ Year Member



This works - except I have to keep the 14pt as the font size. Now I just have to upload the pages/template taking out the leftmargin="1" topmargin="1" marginwidth=" " and the css page and step one of my many errors will be eliminated.

Thanks so much!

Major_Payne

9:45 pm on Jul 13, 2010 (gmt 0)



You're welcome. You can set the equivalent for 14pt size in ems. It's just that "em" is recommended for font sizes.