/    Sign up×
Community /Pin to ProfileBookmark

How in the world does CSS make a page???

Ok, now, I know this is getting old, but could someone please explain to me, in plain english, how CSS can give you a header and a sidebar and a footer or whatever? What I have seen of CSS is just small aplications, like scrollbar colors and stuff like that. Thanks in advance.

to post a comment
CSS

5 Comments(s)

Copy linkTweet thisAlerts:
@IncaWarriorJun 26.2005 — It doesn't, HTML gives you the content, CSS can style it- position all the parts and change the colors, shapes, and sizes.

And no Scrollbar colors are not part of the official CSS spec
Copy linkTweet thisAlerts:
@d0t30authorJun 26.2005 — Well, I know that, but what are all the <div>s laying around for?
Copy linkTweet thisAlerts:
@ray326Jun 26.2005 — They're grouping HTML elements in some (hopefully) logical way so you can use them as part of the css selector to filter out what you don't want to style a certain way. If you have a div with id="nav" then you can specifically style the list of links in it without changing a list in some content area.

#nav ul, #nav li { margin:0; padding:0; list-style:none; }
Copy linkTweet thisAlerts:
@d0t30authorJun 26.2005 — ???
Copy linkTweet thisAlerts:
@FangJun 26.2005 — The HTML contains the content of your document.

The CSS adds style to it; color, borders, position plus many more style options.

Look at this simple document below in your browser, then remove all the contents between the <style> tags. Now look at it again, this is CSS changing the style of the document.
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;title&gt;Basic HTML&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
&lt;meta name="copyright" content="Basic HTML"&gt;
&lt;meta name="keywords" content="Basic HTML"&gt;
&lt;meta name="description" content="HTML template"&gt;

&lt;script type="text/javascript"&gt;
&lt;!--
// all JavaScript here

//--&gt;
&lt;/script&gt;

&lt;style type="text/css"&gt;
&lt;!--
body {
margin:auto;
width:32em;
font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size:100%;
color:#000;
background:#9cf;
}
ul {
margin:0;padding:0;
border:2px solid #ccc;
background:#ffc;
height:1%;
overflow:auto;
}
li {
float:left;
width:25%;
overflow:hidden;
list-style-type:none;
}
li a {
display:block;
text-align:center;
}
li a:hover {
background:#ccc;
color:#ff0;
}
h1 {
font-size:2em;
margin:0.67em 0;
text-align:center;
}
h2 {
float:left;
padding:0 0.5em;
margin:0.5em 0 0 0;
font-size:1.5em;
}
h1, h2 { font-weight: bolder;}
p {
margin:0.5em 0;
border:2px solid #ccc;
padding:1em;
background:#ffc;
}
h3 {
height:1%;
overflow: auto;
margin:1em 0;
border:2px solid #ccc;
padding:0 1em;
background:#ffc;
font-size:1.17em;
}
h3 a {
float:left;
text-decoration:none;
}
h3 span {
float:right;
font-size:0.6em;
}
--&gt;
&lt;/style&gt;

&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;Title of my site&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="home.html"&gt;home&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="services.html"&gt;services&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="customers.html"&gt;customers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="contact.html"&gt;contact&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Lorem ipsum&lt;/h2&gt;
&lt;p&gt;
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Ut viverra ante et wisi. Etiam purus mauris, laoreet nec, facilisis eget, facilisis quis, ipsum.
Phasellus nonummy elementum felis. Suspendisse potenti.
Aliquam feugiat, augue sit amet euismod lacinia, ligula erat aliquet velit, vel porttitor eros ante convallis augue.
Nullam quis pede. Vestibulum pretium eros nec orci. Aliquam ut justo. Duis commodo.
Praesent ut odio semper diam imperdiet elementum.&lt;/p&gt;
&lt;h3&gt;&lt;a href="mailto:[email protected]"&gt;webmaster&lt;/a&gt;&lt;span&gt;updated: 2005 06 26&lt;/span&gt;&lt;/h3&gt;
&lt;/body&gt;
&lt;/html&gt;
[URL=http://www.w3schools.com/css/default.asp]CSS tutorial[/URL]
×

Success!

Help @d0t30 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.17,
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,
)...