Jump to content

Shows color when linked without http://, not with.


Recommended Posts

Hi guys. I'm kinda to PHP and wanted to make my site with PHP. I made a guestbook and I'm trying to display the posts in it.

Simple enough.

 

Here's the problem. I added in my CSS-file that I want links to be green and to underline on hover.

I use IE6 and it won't work, I have not tried IE7 cause I don't have it. I tried back and forth, all kind of ways, and I think I know what happens.

As long as I link the link with "http://" in the beginning it won't work. If I remove that, it will show my CSS. Why is this?

It seems to be IE bug, cause they will all show in green in Firefox (however the underline wont show, I dunno why either lol).

 

Oh, here is my guestbook (still in the works): http://www . mysmasken . se/guestbook.php 

 

 

Your html is not valid. So how can you expect the browser to comply with what you want your page to look like.

 

Any HTML document should at least have the basic set of tags which is this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Your site/page title</title>
<!-- link any external pages here, eg stylesheets or javascript files. -->
</head>
<body>

<!-- all html code for the page here -->

</body>
</html>

 

Yours only has the first two lines!

 

Also you close your tags in the incorrect order which will make your code invalid. This:

<div class="gbname"><a href="http://www.scrappa.com" target="_blank">Scrappa.com</div></a>

is supposed to be this:

<div class="gbname"><a href="http://www.scrappa.com" target="_blank">Scrappa.com</a></div>

 

If you make your code valid then the browser will abide by what you tell it. Otherwise it will go into quirks mode.

 

Another thing is try to format your html code too.

And, in order for your css to be used you have to specify it in the HEAD section like this:

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

 

or you can define inline css styles in the HEAD section like this:

<head>
<title>bla</title>
<style type="text/javascript">
    .someclass { color:red; font-size:120%; }
    ...repeat above
</style>
</head>

--that ain't no ie bug, you can't blame that one on ie. It probably displayed green in ff because that is your default settings for that browser.  ff shouldn't be rendering your css either because you never linked to your css or included it inline.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.