473,511 Members | 15,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Ok, still not getting it....

Hey all!!

Well, I've decided to take the dive and attempt my very own HTML coded
website rather than use a page-editor thingy.

Anyway, I'm attempting to write a style sheet, and have read various
sources describing how to do them and set them out. Whether I'm
completely stupid or whether it's simply because I haven't been able
to ask someone about it, I'm still not sure how the hell a style sheet
should look. I'm attempting to create a sheet to use externally,
mainly to set out my background and text.

The design I'm trying to create is bascially a plain colored
background, with a box in the center of it, bordered by a darker shade
of color and filled with a tiled background image. I'm also attempting
to insert font/text definitions (white verdana font, basically).

So, spefically, I'm wondering a few things. The first is, when I've
looked at the link command used to attach an external sheet, the
instructions say to place the link in the <head> section, thusly:
<link rel="stylesheet" type="text/css" href="filename.css">
I get the HREF tag, but as in this example the TYPE tag is "text/css",
does this mean there are other types of... well, types? What exactly
does this specify? Is it telling the computer to expect a stylesheet
written in a text form or what? I'm also assuming the LINK REL is
telling the computer to expect/read the file as a stylesheet.

The other thing I'm wondering is exactly how a stylesheet should be
laid out when being written. I've looked at a few sheets, and have
seen it done in varying ways that confuse me. My most recent attempt
contained the fields BODY (containing specs for background color, text
color, font family), .BOX (containing specs for box alignment, box
height & width, border color/width/style, margin, and background
pattern). All the definitions were contained with the braces brackets
{ }, as I've seen exampled and implemented in others' sheets. What am
I missing? Is there anything else I should be specifying? If not, then
why the hell didn't it work when I wrote HTML for my front page and
stuck the link ref in the header?!?!?! :-)

Sorry if this has been answered time and again, and apologies for
length, but I'm so totally lost and can't seem to find answers
anywhere!!! Please, feel free to laugh at my stupidity on the
condition you answer my questions!!! :-)

Thanks!
~L
Jul 20 '05 #1
5 1683
lo*****@ozconnect.net.au wrote:

Anyway, I'm attempting to write a style sheet, and have read various
sources describing how to do them and set them out. Whether I'm
completely stupid or whether it's simply because I haven't been able
to ask someone about it, I'm still not sure how the hell a style sheet
should look. I'm attempting to create a sheet to use externally,
mainly to set out my background and text.


You can open e.g. the W3C page in source view, and find the stylesheet,
then download and open it:
http://www.w3.org

Also, above contains all the references you need.
Additionally, enter things you want to know in Google. Like "css
tutorial" should be a good start.
--
Google Blogoscoped
http://blog.outer-court.com
Jul 20 '05 #2
<lo*****@ozconnect.net.au> wrote in message
news:jl********************************@4ax.com...
So, spefically, I'm wondering a few things. The first is, when I've
looked at the link command used to attach an external sheet, the
instructions say to place the link in the <head> section, thusly:
<link rel="stylesheet" type="text/css" href="filename.css">
I get the HREF tag, but as in this example the TYPE tag is "text/css",
does this mean there are other types of... well, types? What exactly
does this specify? Is it telling the computer to expect a stylesheet
written in a text form or what? I'm also assuming the LINK REL is
telling the computer to expect/read the file as a stylesheet.
Read this portion of the spec:
http://www.w3.org/TR/html4/struct/links.html#h-12.3
(quicker than trying to explain it here). :)


The other thing I'm wondering is exactly how a stylesheet should be
laid out when being written. I've looked at a few sheets, and have
seen it done in varying ways that confuse me. My most recent attempt
contained the fields BODY (containing specs for background color, text
color, font family), .BOX (containing specs for box alignment, box
height & width, border color/width/style, margin, and background
pattern). All the definitions were contained with the braces brackets
{ }, as I've seen exampled and implemented in others' sheets. What am
I missing? Is there anything else I should be specifying? If not, then
why the hell didn't it work when I wrote HTML for my front page and
stuck the link ref in the header?!?!?! :-)


It's hard to say without seeing the code. Can you provide a link to the
code in question?

Regards,
Peter Foti
Jul 20 '05 #3
On Fri, 10 Oct 2003 01:33:55 +1000, lo*****@ozconnect.net.au wrote:
The other thing I'm wondering is exactly how a stylesheet should be
laid out when being written. I've looked at a few sheets, and have
seen it done in varying ways that confuse me. My most recent attempt
contained the fields BODY (containing specs for background color, text
color, font family), .BOX (containing specs for box alignment, box
height & width, border color/width/style, margin, and background
pattern). All the definitions were contained with the braces brackets
{ }, as I've seen exampled and implemented in others' sheets. What am
I missing? Is there anything else I should be specifying? If not, then
why the hell didn't it work when I wrote HTML for my front page and
stuck the link ref in the header?!?!?! :-)


I think your mistake might be that you expect the browser to define
your box based on the definitions you provide in .BOX.
But .BOX is a class, and you must further define which part of your
page falls into that class.
ie <div class="box"> this is a box </div>
Or else I completely misunderstand your question :)
Jul 20 '05 #4
On Fri, 10 Oct 2003 01:33:55 +1000, lo*****@ozconnect.net.au wrote:
<link rel="stylesheet" type="text/css" href="filename.css"> does this
mean there are other types of... well, types?
Yup. This is the MIME type, telling the browser what kind of file to
expect from the server. If you've ever messed around with what program
opens what types of files in Windows (setting Winamp to open .wav files,
for example) you've dealt with MIME types.

Possible types are "text/html", "image/png", "image/gif", "video/mpeg",
"text/css", and "audio/basic", among others.
I'm also assuming the LINK REL is telling the computer to expect/read
the file as a stylesheet.
REL is an attribute of LINK (and less commonly A). It states the
relationship of the linked object to the page you're on (forward, back,
stylesheet, etc.). The full explanation would be pretty long; visit
http://www.w3.org/TR/html401/types.html#type-links if you're interested in
details.
The other thing I'm wondering is exactly how a stylesheet should be laid
out when being written.


There are rules, and then there are conventions. Conventions are things
like capitalizing HTML elements like BODY and P, making classes and ids
lowercase (.class or #id), and putting excessive whitespace, tabs, or
newlines in to make it more readable. That sort of stuff is optional.

A basic sheet like you described should run something like:

BODY { background-color: #ffffff; /* or #fff, or white */
color: #000000;
font-family: sans-serif;
}

..BOX { position: relative;
height: 10em; /* units in em, px, or % */
width: 30em;
border: 1px solid #0000ff;
margin: 0 1em 0 1em; /* or define margin-left, -right, etc. */
background-image: url(path);
}

Do _not_ forget those semicolons between properties -- very common
mistake. Just to clarify fully, comments are put /* between these markers
*/ and are ignored totally; handy when you want to do a quick subtraction
from the code to test something.

The page it fits into would be, in brief:
<HTML>
<HEAD><TITLE>Inside the box</TITLE>
<LINK rel="stylesheet" type="text/css" href="style.css"></HEAD>
<BODY>
<DIV class="BOX">This goes in the box, with or without P tags.</DIV>
</BODY>
</HTML>

Personally, I'd try plunking your styles between <STYLE> tags in the
webpage itself to make sure whether the stuff works before putting it in
an external file. It's easier to edit when it's right up there in the
HEAD portion, and you don't run into the occasional problem with servers
not having the correct settings to serve up stylesheets.

If you feel up to posting your sample code, either here or in an obscure
corner of a server that you can link to, we can look it over and tell you
more specifically what might be wrong. Or check out
http://jigsaw.w3.org/css-validator/ , which allows you to run your code by
a machine (guaranteed not to snicker).

Alison
-----------
http://www.painters-wing.com
Jul 20 '05 #5
Alison Stewart wrote:
[snip]
There are rules, and then there are conventions. Conventions are
things like capitalizing HTML elements like BODY and P, making
classes and ids lowercase (.class or #id), and putting excessive
whitespace, tabs, or newlines in to make it more readable. That sort
of stuff is optional.

[snip]

I accept that you talk about this as a convention, not a rule. But is
capitalisation even a good convention?

I assume that it is a good principle for the case used in the CSS
corresponding to HTML elements such as "body" to match the HTML. But I thought
that the trend in future standards was to be towards lower-case for the
latter.

(I also estimate that there is more lower case than upper case "out there").

--
Barry Pearson
http://www.Barry.Pearson.name/photography/
http://www.BirdsAndAnimals.info/
http://www.ChildSupportAnalysis.co.uk/
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6888
by: Eyal | last post by:
Hey, I would appriciate if anyone can help on this one: I have a java object/inteface having a method with a boolean parameter. As I'm trying to call this method from a javascript it fails on...
5
1883
by: Francis Bell | last post by:
I just found that my fin stream is not getting passed to my readInASpinnerbait function. Here's what I have: string readInFirstChars(ifstream &fin) { char first; string print; while...
8
9987
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
0
2210
by: Si | last post by:
I'm writing an HttpModule to intecept web method calls and retrieve custom authentication information from their SOAP headers. I have the httpModules tag in web.config and that appears to be...
3
3674
by: dei3cmix | last post by:
Hey, I am having a problem with a program I am working on. Basically, the first part of the program gets input from a file using cin.getline. Then the second part, (still in the same main as the...
32
4961
by: paul | last post by:
HI! I keep on getting this error and I have tried different things but I am not sure how to send the expiring date. The error that I am getting in Firefox 1.5 is "Error: expires.toGMTString is...
2
4202
by: MSK | last post by:
Hi, Continued to my earlier post regaring "Breakpoints are not getting hit" , I have comeup with more input this time.. Kindly give me some idea. I am a newbie to .NET, recently I installed...
4
4464
by: R.Manikandan | last post by:
Hi In my code, one string variable is subjected to contain more amount of characters. If it cross certain limit, the string content in the varabile is automatically getting truncated and i am...
4
5683
by: imaloner | last post by:
I am posting two threads because I have two different problems, but both have the same background information. Common Background Information: I am trying to rebuild code for a working,...
0
7349
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7074
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7506
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4734
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3219
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3210
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1572
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.