Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Baffled by ignored CSS file

Tags:

html

css

A ridiculously simple bit of web coding is failing to work for me, and for the life of me I can't figure out what I'm doing wrong.

This is my HTML file:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Experiment</title>
    <link rel="stylesheet/css" type="text/css" href="/team/css/style.css">
</head>

<body>
    <div id="user_box">
       <p>Hi.  Whassup?</p>
    </div>
</body>
</html>

And this is the CSS file it's linking to:

#user_box {
    position: fixed; 
    left: 10px; 
    top: 10px; 
    padding: 5px;
    z-index: 100; 
    height: 40em; 
    width: 16em;
    background-color: white;
    border: solid black;
}

It doesn't work. The CSS formatting is ignored entirely. However, when I copy the content of #user_box into a style= tag, it works exactly the way I think it should.

I'm confirming that the CSS file is where it should be and the browser can see it; when I view the source, I can click that link, and it downloads just fine.

I suspect I'm missing something obvious/stupid, but I'm failing to figure out what it is. I beg you, point out my stupid and get a shiny shiny check mark.

like image 517
BlairHippo Avatar asked Jul 31 '26 02:07

BlairHippo


1 Answers

The correct rel for a stylesheet is simply stylesheet, not stylesheet/css. Remove that /css and all should be fine.

like image 179
Niet the Dark Absol Avatar answered Aug 02 '26 19:08

Niet the Dark Absol



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!