/    Sign up×
Community /Pin to ProfileBookmark

A few CSS questions

Hi there Guys

Hoping that someone can answer a few questions I have. A couple are really easy but one I think is a little more tricky!

What is the difference between calling a div as an ID or a CLASS???

I’m trying to layout the following page (excuse the colours, just there to make the divs visible. I want the ad div to be 10 px from the top and right of the content div. Please could someone tell me what i’m doing wrong.

Thanks!

[code=html]<!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”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />
<title>Untitled Document</title>

<style type=”text/css”>

#content
{
width: 800px;
background: #999999;
}

#menu
{
width: 100%;
background: #FF0000;
height: 30px;
}

#story
{
width: 80%;
background: #FFFFFF;
}

#ad
{
background: #FF9900;
width: 100px;
height: 45px;
position: relative;
top: 10px;
right: 10px;
}

</style>

</head>

<body>

<div id=”content”>

<div id=”menu”>
Menu 1 | Menu 2 | Menu 3
</div>

<div id=”story”>This is my really long boaring story to go on the home page. Blah blah blah. This is my really long boaring story to go on the home page. Blah blah blah. This is my really long boaring story to go on the home page. Blah blah blah. This is my really long boaring story to go on the home page. Blah blah blah. This is my really long boaring story to go on the home page. Blah blah blah. This is my really long boaring story to go on the home page. Blah blah blah. This is my really long boaring story to go on the home page. Blah blah blah. This is my really long boaring story to go on the home page. Blah blah blah. This is my really long boaring story to go on the home page. Blah blah blah. This is my really long boaring story to go on the home page. Blah blah blah. This is my really long boaring story to go on the home page. Blah blah blah. This is my really long boaring story to go on the home page. Blah blah blah. </div>

<div id=”ad”>
Ad here
</div>

</div>

</body>
</html>
[/code]

to post a comment
CSS

4 Comments(s)

Copy linkTweet thisAlerts:
@tommywdsauthorJun 16.2007 — Sorry should also have said I want the ad html code at the bottom of the page so if a browser does not support css it does not get in the way.

Thanks!
Copy linkTweet thisAlerts:
@FangJun 16.2007 — ID v CLASS
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;

&lt;style type="text/css"&gt;
/*&lt;![CDATA[*/
#content {
width: 800px;
background: #999999;
position:relative;;
}
#menu {;
width: 100%;
background: #FF0000;
height: 30px;
}
#story {
width: 80%;
background: #FFFFFF;
}
#ad {
background: #FF9900;
width: 100px;
height: 45px;
position:absolute;
top:0;
right:0;
margin:10px 10px 0 0;
}
/*]]&gt;*/
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id="content"&gt;
&lt;div id="menu"&gt;Menu 1 | Menu 2 | Menu 3&lt;/div&gt;
&lt;div id="story"&gt;This is my really long boring story to go on the
home page. Blah blah blah. This is my really long boring story
to go on the home page. Blah blah blah. This is my really long
boring story to go on the home page. Blah blah blah. This is my
really long boring story to go on the home page. Blah blah blah.
This is my really long boring story to go on the home page. Blah
blah blah. This is my really long boring story to go on the home
page. Blah blah blah. This is my really long boring story to go
on the home page. Blah blah blah. This is my really long boring
story to go on the home page. Blah blah blah. This is my really
long boring story to go on the home page. Blah blah blah. This
is my really long boring story to go on the home page. Blah blah
blah. This is my really long boring story to go on the home
page. Blah blah blah. This is my really long boring story to go
on the home page. Blah blah blah.&lt;/div&gt;
&lt;div id="ad"&gt;Ad here&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
Copy linkTweet thisAlerts:
@WebJoelJun 16.2007 — ....#menu {[B][COLOR="Red"];[/COLOR][/B]

width: 100%;

background: #FF0000;

height: 30px;

}.... [/QUOTE]
A typographical error, I'm sure. ?
Copy linkTweet thisAlerts:
@tommywdsauthorJun 16.2007 — Thanks for all your help!

Will give that a go!
×

Success!

Help @tommywds spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...