/    Sign up×
Community /Pin to ProfileBookmark

CSS coding problem

I’ve learned CSS, well just a couple of hours ago with the tutorials at w3schools.com and i have one question

I want to have my logo/banner displayed on every page of my website, so i did this in my ***.css file:

body
{
background-image:url(‘logo.gif’);
background-repeat:no-repeat;
background-attachment:fixed;
}

and i link all of my pages to this css file, i figured since all html codes have body so i’ll have my logo on all my pages ? problem solved.

However,1 major problem. When i start inserting my contents into these pages, the content overlaps the logo. The words start from the top of the page, overlapping my logo. So i thought i could do this:

p
{
margin-top:150px;
}

since the height of my logo is 150pixels, this makes sure all my content starts after 150.

But here comes another problem, whenever i use the <p> tag, it always leaves a top margin of 150. How do i make d rest of my content to display relative to this 150 border? First question.

Second question, what is div? how do i use it? it wasn’t covered in the w3school tutorial, or maybe i didnt understand it.

Third question, how do i insert my menu links on the left of every page the same way as my banners in css?

to post a comment
CSS

4 Comments(s)

Copy linkTweet thisAlerts:
@the_treeJan 09.2005 — Try:body
{
background-image:url('logo.gif');
background-repeat:no-repeat;
background-attachment:fixed;
margin-top:150px;
}


A div is a block level element with no sematic value, that way you can use it for anything providing a better element doesn't exist. Alot of people use them as containers for the site or to split up their menu/sidebar from their main content.
Copy linkTweet thisAlerts:
@MagmaauthorJan 09.2005 — That worked! But i'm a little confused. By adding margin-top:150px shouldn't the margin be at the top of my logo.gif? Like this

How about my 3rd question?how do i insert my links in my .css file so that it can be displayed on all my pages?
Copy linkTweet thisAlerts:
@MstrBobJan 09.2005 — You can't insert HTML into a CSS file. You want to have the same HTML on all pages?

[URL=http://webdevfaqs.com/php.php#include]Server Side Includes[/URL]
Copy linkTweet thisAlerts:
@MagmaauthorJan 09.2005 — Thx mstrbob..i guess i cant run away for server side scripting ?
×

Success!

Help @Magma 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 6.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...