3 Replies - 424 Views - Last Post: 07 May 2010 - 03:54 PM

#1 Nahemah  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 22-May 07

What's wrong in this?

Posted 07 May 2010 - 01:34 PM

Hello!

I'm making my first website ever for a school project.

I'm very ambitious and I want to make a very nice looking and functional website!

I've been reading the CSS tutorials at w3s and when I try to add a margin to the text, it wont put it where I want, this also happened to the text, if I change something in it the background won't show up for some reason (I hope I'm not being very confusing)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<title>Portfólio de Multimédia</title>
<style type="text/css">
body
{
background-color:#FACB3D;
background-image:url('http://img8.imageshack.us/img8/159/background2xz.png');
background-repeat:no-repeat;
background-position:center center;
background-attachment:scroll;
}
</style>
<style type="text/css">
margin-top:100px;
margin-bottom:10px;
margin-right:40px;
margin-left;50px;
}
</style>
</head>
<body>
<p class="margin">loll.</p>


</html>


What's wrong in this?

Ty.

Is This A Good Question/Topic? 0
  • +

Replies To: What's wrong in this?

#2 SeiferMaster  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 27
  • Joined: 28-October 09

Re: What's wrong in this?

Posted 07 May 2010 - 02:10 PM

You simply didn't declare your "margin" class in the CSS.

<style type="text/css">
.margin{
  margin-top:100px;
  margin-bottom:10px;
  margin-right:40px;
  margin-left;50px;
}
</style>



You could also do this to declare your margin

.margin{
  margin: 100px 40px 10px 50px;
}



It declares margin in that order: TOP RIGHT BOTTOM LEFT

This post has been edited by SeiferMaster: 07 May 2010 - 02:12 PM

Was This Post Helpful? 0
  • +
  • -

#3 Nahemah  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 22-May 07

Re: What's wrong in this?

Posted 07 May 2010 - 02:18 PM

Thank you so much!
Was This Post Helpful? 0
  • +
  • -

#4 jrm402  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 51
  • View blog
  • Posts: 333
  • Joined: 18-March 10

Re: What's wrong in this?

Posted 07 May 2010 - 03:54 PM

Just remember, you have to follow this format for CSS:

selector { property: value;  property: value; }
           \______________/  \______________/
                  |                 |
                  |                 |
              Declaration       Declaration



If you wanted to apply a style to everything you can use this selector:
* { margin: 100px 40px 10px 50px; }



:)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1