/    Sign up×
Community /Pin to ProfileBookmark

CSS Newbie…Using CSS for text in a web layout…

I was going to use a normal HTML table to put text in, and it was giving me trouble, so someone suggested I post in CSS. While I know a lot of basic HTML, CSS is completely new to me. I read part of the tutorial from HTMLgoodies.com, so I know a little bit about it, but I don’t know how to get started or how I should use it.

Here’s the thing: I have a background texture on the page, and I want a text area with a background of #a9a9a9. Can someone get me started?

to post a comment
CSS

7 Comments(s)

Copy linkTweet thisAlerts:
@NogDogAug 11.2006 — Here's a fairly simple example. It shows how all the visual layout stuff is transfered to the CSS (the <style> block in this case), leaving the actual content clean and mainly marked up with HTML elements that define the [i]meaning[/i] of the text, not its appearance.
[code=html]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang='en'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>
<title>Page Title</title>
<style type="text/css">
body {
margin: 0;
padding: 50px;
font: medium arial, sans-serif;
/* replace color and image name below with desired values */
background: #cccccc url(background_image.gif) repeat 0 0;
color: black;
}
/* the following will apply to the DIV element with id="main_text" */
#main_text {
margin: 0;
padding: 1em;
background-color: #a9a9a9;
color: black;
border: solid 3px #000000; /* change style, thickness and color as desired */
}
</style>
</head>
<body>
<div id="main_text">
<h1>Here Is the Title</h1>
<p>This is a paragraph. This is a test. It is only a test. This is
the end of the paragraph.</p>
<p>This is a paragraph. This is a test. It is only a test. This is
the end of the paragraph.</p>
</div>
</body>
</html>
[/code]
Copy linkTweet thisAlerts:
@JennaWrennauthorAug 11.2006 — Wow...fairly simple? What did I get myself into?? LOL, j/k.

I'll try it real quick, and see if I have any questions...Thanks!
Copy linkTweet thisAlerts:
@JennaWrennauthorAug 11.2006 — Ok, so I see how it works. Questions:

Can I make the table border not so thick? I'd like 1 pixel if possible.

It covers up my background texture. Is there a way to either take out background color, or should I just put the background URL in the CSS?

I think I can just go back to HTMLgoodies for details like changing fonts and sizes and stuff...

Thanks again!
Copy linkTweet thisAlerts:
@JennaWrennauthorAug 11.2006 — Oh, I see the background part! *red face*

Now 1 more question-- can I just put like "background.png," or does it have to be a URL?
Copy linkTweet thisAlerts:
@JennaWrennauthorAug 11.2006 — Wait, dumb question...nevermind ?
Copy linkTweet thisAlerts:
@JennaWrennauthorAug 11.2006 — (s)...dumb questions...thanks, I'll figure it out from here! THank you very much!
Copy linkTweet thisAlerts:
@NogDogAug 11.2006 — LOL - with the positive attitude and willingness to learn that you appear to have, you'll pick it up. There are a lot of possibilities, and some of it does get a bit complex. When you need inspiration, stop by www.csszengarden.com and view all the layouts there. (Note that the body content of every page is the same, all the visual differences come from the different CSS stylesheets that are used.)

For a pretty friendly tutorial, stop by www.htmldog.com. (It's one minor drawback is that it assumes use of XHTML instead of HTML.)
×

Success!

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