aligning DIV in css - Noob Question.

J

jobs

sorry for the noob question.

I know I can position a div tag in hmtl as such..

<div id=ccc style="align:bottom;position:absolute;left:1px;width:
200px;height:300px;border: ghostwhite thin ridge;float-right">
hello
</div>

is there any way to do all of this in css?

I tried this with no luck. I know the css is taking some effect
because i set background-color in the body entry and it worked.

<div id="ccc">
hello
</div>

css:

#ccc
{
position:absolute;
left:200px;
top:400px;
width:200px;
height:300px;
border: ghostwhite thin ridge;
color: red;
background-color:blue;
}

FYI, i doing all of this in asp.net 2.0.

Another question, when should I use DIV and when should I use SPAN?

Thank you for any help or information!
 
B

Ben C

sorry for the noob question.

I know I can position a div tag in hmtl as such..

<div id=ccc style="align:bottom;position:absolute;left:1px;width:
200px;height:300px;border: ghostwhite thin ridge;float-right">
hello
</div>

Almost. There's no align property, but you might be thinking of
"vertical-align". And you need float: right, not float-right.
is there any way to do all of this in css?

You have already done it in CSS. The string inside the style attribute
_is_ CSS.
I tried this with no luck. I know the css is taking some effect
because i set background-color in the body entry and it worked.

<div id="ccc">
hello
</div>

css:

#ccc
{
position:absolute;
left:200px;
top:400px;
width:200px;
height:300px;
border: ghostwhite thin ridge;
color: red;
background-color:blue;
}

That looks fine, there's no reason why it shouldn't work. You need to
post a URL.
Another question, when should I use DIV and when should I use SPAN?

Whichever you want really. Usually DIV for block-level things and SPAN
for inline-level things. Use the other HTML elements unless there isn't an
appropriate one for what the element contains.
 
J

John Hosking

jobs said:
sorry for the noob question.

We're all noobs sometime. :)
I know I can position a div tag in hmtl as such..

You mean a div *element* (which is delimited in the code by tags). You
also mean HTML.
<div id=ccc style="align:bottom;position:absolute;left:1px;width:
200px;height:300px;border: ghostwhite thin ridge;float-right">
hello
</div>

Only some of the above is valid CSS; some is just made up.
is there any way to do all of this in css?

Well, that was dressed as CSS (even if it wasn't actually valid), so you
seem to think you're asking for the CSS equivalent of CSS.
I tried this with no luck. I know the css is taking some effect
because i set background-color in the body entry and it worked.

<div id="ccc">
hello
</div>

css:

#ccc
{
position:absolute;
left:200px;
top:400px;
width:200px;
height:300px;
border: ghostwhite thin ridge;
color: red;
background-color:blue;
}

Ah, I think I'm starting to get what you're wanting. You know you can
use inline styles (your "in hmtl as such"), and now you want to use
embedded or external styles.

Without a URL pointing to the page you're having "no luck" with, I can't
tell you what's wrong. But get in the habit of validating your code,
http://validator.w3.org/ for markup, http://jigsaw.w3.org/css-validator/
for CSS.
FYI, i doing all of this in asp.net 2.0.

No guts, no glory, I guess. You'll need to check the finished results
produced by any tool you use.
Another question, when should I use DIV and when should I use SPAN?

Less often than you think. For paragraphs, use <p></p>, for headings use
<h1>, <h2>, etc., for lists of thins use list markup. A div is a generic
block-level element that you can use when no other markup is
appropriate. A span is an in-line element that you can use when no other
markup is appropriate. Both of these elements (div especially) are often
misused when a more semantically meaningful element should be used. See
the specs at http://www.w3.org/TR/html401/struct/global.html#h-7.5.4 .
Thank you for any help or information!

You're welcome. Hope this helps.
 
D

dorayme

John Hosking said:
We're all noobs sometime. :)

There should be a newsgroup where it is perfectly ok to ask
genuine questions no matter how clueless they look. Where the
experts are all nice mammas who make great chicken soup and
nothing is too much trouble. Imagine for example JK in an apron
over a hot stove, go on, try it. Perhaps there is a little corner
in heaven where this is actually so.
 
A

Adrienne Boswell

Gazing into my crystal ball I observed dorayme
There should be a newsgroup where it is perfectly ok to ask
genuine questions no matter how clueless they look. Where the
experts are all nice mammas who make great chicken soup and
nothing is too much trouble. Imagine for example JK in an apron
over a hot stove, go on, try it. Perhaps there is a little corner
in heaven where this is actually so.

I'm a nice mama and I make great Salmon en Papillote with Green Sauce and
Risotto Milano followed by a raspberry chocolate mousse trifle. That's
not too much trouble. I don't have an apron, but I have 18/10 stainless
pots and pans.
 
D

dorayme

Adrienne Boswell said:
Gazing into my crystal ball I observed dorayme


I'm a nice mama and I make great Salmon en Papillote with Green Sauce and
Risotto Milano followed by a raspberry chocolate mousse trifle. That's
not too much trouble. I don't have an apron, but I have 18/10 stainless
pots and pans.

My God, that dish sounds good! Time to at least go and see
'Babbette's Feast' again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top