PDA

View Full Version : [Q] How to load CSS definitions from the BODY tag???


CyanBlue
02-15-2004, 01:28 PM
Howdy, guys... :)

The first day on my CSS really confuses me... :(

I've read several online tutorials and I was able to create(read copy and paste from other CSS files) one sample to play with... and it works great when I plug it into the HTML file...

Now, I've read that I can call the CSS file within the HEAD tag of the HTML file... (That's how I have practiced with the sample...)

Here is the question for you...

I am looking for a way to format the documents that I am providing without the HEAD tag... I am only supposed to format the texts that are in the BODY tag...
In other words, I have no access on the HEAD tag and whatever else...

Can I do that??? If so, how would I load the CSS definitions from the BODY tag???

Thank you very much...

Cota
02-15-2004, 01:37 PM
I think you can use Global Stylesheets without using a head tag. Define the Stylesheets before the body, pretty sure global doesnt require the head tag.

<.style type="text/css".>
STYLE INFORMATION GOES HERE
<./style.>

splict
02-15-2004, 01:44 PM
also, I tried using the <link> tag in the body, to load an external stylesheet and it seemed to work fine. Is that all you are trying to do or maybe I am missing something?

CyanBlue
02-15-2004, 01:56 PM
Yeah... I tried both methods and both worked... :D
(I had to get rid of the '.' in front of the style in Cota's example in case somebody complains later on... ;))

Thank you very much, guys... :)

Cota
02-15-2004, 02:04 PM
Glad I could return the favor

splict
02-15-2004, 02:06 PM
me too. Working on a Sunday, huh? I might feel bad for you - if I wasn't doing the same ;)

CyanBlue
02-15-2004, 02:14 PM
Hm... Returning the favor??? Did I do something??? I don't remember... Um... Are you the one who borrowed five bucks last summer??? :D

Um... Working... It depends on how you define that term... :D
I'm just playing with the computer... That's all, I guess... ;)

Okay... As for an update for that CSS stuff... I am working on a small tutorial page at the moment and I've downloaded great script from one of the German guy's website... That's where I need to provide the 'BODY' tag comes from... Well... This is what I did... I just copied and pasted whole HTML file including the HTML tag into the text area and guess what, it does work the same way as what you guys have suggested... :D

Of course, there were a couple of the formats that were already defined on the main CSS file of the script which I should edit again, and I'd need to browse the web for some more on CSS stuff, but it's looking great... ;)

splict
02-15-2004, 02:21 PM
I just thought maybe this studying was related to that fancy new job you have ;)

You are following a tutorial? Who is the german guy? :confused: Sounds interesting. My css knowledge is non-existent. My tutorials, lately, consist of playing around with dreamweaver and then looking at the code it writes. Not very structured, but...

Cota
02-15-2004, 02:42 PM
You should try www.webmonkey.com from some good CSS tutorials, articales, etc.

CyanBlue
02-15-2004, 03:01 PM
Ah... Webmonkey... How can we survive without that... Thanks, Cota... :)

No, splict... It sounds like you sorta skipped last night's sleep over the code, eh??? :p

I've downloaded Article Engine from this page so that I can create a simple tutorial site of mine or whatever...
http://www.alexscriptengine.de/art_engine/article.php?article=2&PHPSESSID=774b4bf3b7ed45ba088e18403fa455b7

And, I needed to add some CSS stuff so that it will be looking abit better... That's where I needed to go through several CSS online tutorials and articles since I had no idea on what CSS does and is... :)

tg
02-18-2004, 09:53 AM
Originally posted by CyanBlue
Ah... Webmonkey... How can we survive without that...

i guess we'll find out. webmonkey is about to shut it all down.

http://www.wired.com/news/infostructure/0,1377,62300,00.html?tw=wn_tophead_4

CyanBlue
02-18-2004, 08:08 PM
So I have heard... Too bad... :(

Cota
02-18-2004, 08:27 PM
Why is web monkey going to shut down, they've been so good to me over the years.

tg
02-19-2004, 08:51 AM
layoffs from the parent company.

AnubisibunA
02-19-2004, 09:55 AM
I only skimmed these replies... so I hope this is what you are asking...

why not just use the 'body' attribute

<STYLE type="text/css">
<!--
body {
margin: 0px;
padding: 0px;
text-align: center;
background-image: url(http://www.website.com/bg.gif);
font-size: 11px;
font-weight: normal;
word-spacing: normal;
letter-spacing: normal;
text-transform: none;
font-family: Verdana, Arial, sans-serif;
}
-->
</STYLE> that's just some of the attributes one can use... not all needed, obviously. Never used a CSS in Flash though, so do not know if everything matches up as well as in HTML.

A stylesheet does not have to go in between the <head> tags though... for it can go above or below the <body> tag as well - it's just that none of the styles will show in your WYSIWYG view... only on preview/server-side.

Hope this helps.
EDIT: whoops... forgot to add this little "cheat" I love to use... and hardly ever see used

<FONT style="font-size: 12px; font-family: Verdana, Arial, sans-serif"; color="#000000">sample 12px</FONT>

it mimics a stylesheet - in that you can specify pixel-sizes/em-sizes/point-sizes - but is used as a regular FONT tag. Handy for little bits of text or paragraphs that don't need a whole stylesheet atrribute for. Also, obviously never changes with a user's changing browser font-size.

tg
02-19-2004, 11:34 AM
why use a deprecated tag (<font>) if your using style sheets, and can do all that inside your style sheet?

AnubisibunA
02-20-2004, 12:33 AM
I use it (fake font tag) in email marketing... or in times where a stylesheet might not be viewable/work by a specific audience - or get filtered.

I agree, css is the way to go --- but in times where you need only a line or two of static(not browser changeable) text, I personally like using the font style tag - since I can guarantee it's viewability by all.

tg
02-20-2004, 11:36 AM
ok, gotcha.