# Css...



## Vetch (Apr 1, 2003)

I've been making websites for a number of years now, however, I just can't seem to get CSS to work when running my Mac.

The problem is as follows:

I'm writing a database driven website using PHP and MySQL, everything was going well until I tried to include an external CSS file to allow me to change fonts/rollovers/everything else people do with CSS with ease. However, it's not workingg. The weird thing is that when I'm running the site from my server PC users can log into the site and see the CSS working fine... So frustrating!

Anyway, here follows two lines of code, the first from the HTMl document, that includes the CSS, and the second from the CSS itself.

If anyone can find any errors in either of the lines of code that could make the CSS not work (on both Safari and IE under Mac OS X.2.3 (no time to upgrade damnit!)) then I would appriciate it, otherwise if there is a known way to fix CSS then that'll help too.

HTML/PHP:

<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"css/styles.css\"> 

CSS:

ltext { color: #040D52; font-size: 8pt }

Thanks muchly in advance,

Vetch


----------



## Darkshadow (Apr 1, 2003)

Hmm, I have CSS working with apache on my machine.  I don't really host a site, just do small tests with it, but it works.  Though I haven't tried it with PHP...maybe I'll try a little later and see if that makes any sort of difference.  It shouldn't, but you never know.


----------



## twister (Apr 1, 2003)

CSS check
http://www.htmlhelp.com/tools/csscheck/

Also what is : ltext { color: #040D52; font-size: 8pt }

If you are calling it by class="ltext" then in the style sheet it should be called  .ltext { color: #040D52; font-size: 8pt }


----------



## bootedbear (Apr 1, 2003)

> If you are calling it by class="ltext" then in the style sheet it should be called .ltext



Good catch, Twister!

I'm a heavy user of CSS in all my sites and have had no problems in any of the browsers (except for the minor hiccups in Safari that are not surprising for a beta).

If your prob is not as Twister predicted, what does the <link> tag look like after it is processed by php and sent to the browser? (use view source)

bear


----------



## Vetch (Apr 1, 2003)

Okay, the lack of .ltext was a typo - the actual thing does have the full-stop (sorry for being so british  ) and the view source looks like:

<LINK REL="stylesheet" TYPE="text/css" HREF="css/styles.css">

Unsurprisingly 

Keep the ideas coming!


----------



## twister (Apr 1, 2003)

Can you show us the actual css and file?  It'd be easier to see what's happening.

Also, while were on the CSS topic.  Can i have multiple styles for a link?  I want some links underlined, some not.  Things like that? I tried the other day but I think i was doing something wrong.  Do i not create any style for A:Link and just put all that style in a .LinkUnderline?  

Does that make since?


----------



## toast (Apr 1, 2003)

You can simply write:
.anyname { style characteristics }

then for your link write:
<a.anyname href="url">text</a>

Source of info: my mate ASH.


----------



## twister (Apr 1, 2003)

Thanks a BUNCH!


----------



## toast (Apr 1, 2003)

More info at A List Apart. Watch this site. They're real CSS killers, just like Zeldman is.


----------



## Vetch (Apr 2, 2003)

I can't exactly print two files here. If you give me your e-mail address though I'll send it to you - unless you have MSN in which case we can meet on there and I'll give you my IP so you can see it running from my server.

Cheers.


----------



## Darkshadow (Apr 2, 2003)

I tested out a PHP with CSS...worked fine.  Are you sure there aren't any errors in the stylesheet you're linking in?


----------



## twister (Apr 2, 2003)

Feel free to email me or pm me. You can do that by clicking the profile button at the bottom of this post


----------



## Vetch (Apr 2, 2003)

Darkshadow: Positive there are no errors. I've coded PHP and CSS together before, which is why I don't think it's actually a problem with the code. I'm wondering if there is a way that CSS is messed up on my computer, or if I have to do something to turn it on (which I serverly doubt)...

Especially since the code worked fine on my friends PC when he visited the website (see original post)...

Any ideas about system configs that I need to change?


----------



## twister (Apr 2, 2003)

New question.  Is this <LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"css/styles.css\">  inside the php <? ?> tags?  If not then you should just have  <LINK REL="stylesheet" TYPE="text/css" HREF="css/styles.css">


----------



## twister (Apr 2, 2003)

example....

<html>
<head>
<title> <? $pageName ?> </title>
<LINK REL="stylesheet" TYPE="text/css" HREF="css/styles.css">
</head>

<body>

<?

$content;
echo ("all php code goes in this area");

?>

</body>
</html>

-----end example ---
this was written off the top of my head.  not checked for errors.


----------



## Vetch (Apr 2, 2003)

Tried that. Didn't work. I even just created a .html file this afternoon and tried to get CSS working on that, with no success. 

I'm now assuming that it's my computer, not the code!


----------



## Arden (Apr 2, 2003)

How odd.  Can you post or send me your sample files that you tried to get working?  It should work on your computer... even if it's not online.  One thing you have to do, is load the external CSS file every time you change it if it's on your HD, or else the changes are not reflected in your page.

Try this.  Create a new file, and type (or copy):

```
<html>
<head>
<title>Sample Page</title>

<link rel="stylesheet" type="text/css" href="sample.css" />

</head
<body>
<span>This is a sample span.</span>
</body>
</html>
```
Save this file somewhere as "sample.html".  Now, create a new file and type/copy the following:

```
span {font-size: 18px;
 font-family: courier;
 color: red}
```
Save this as "sample.css" in the same directory as sample.html, and fire it up in your browser of choice (or other browsers... be sure that the problem isn't just your browser!).  Then give us the results.


----------



## Darkshadow (Apr 3, 2003)

Hmm, are you using the same web browser you were before?  Or, did you turn off CSS rendering in the browser at some point and then forget to turn it back on?  It could be that.


----------



## Vetch (Apr 3, 2003)

Problem solved!

I think something odd happened to the files (God only knows what) but I got annoyed last night and remade both the .css and the .php files from scratch without copying/pasting anything, and it worked first time. Corrupt files or something? This would probably also explain why it worked on a PC and not a Mac or Linux - PCs are corrupt anyway, so it didn't matter running messed up files..

Well, there's another problem sorted... Thanks all for help!


----------

