Hack Forums
[Help] Why isn't my HTML document linking properly to my CSS file? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Coders Lounge (https://hackforums.net/forumdisplay.php?fid=5)
+---- Thread: [Help] Why isn't my HTML document linking properly to my CSS file? (/showthread.php?tid=6014806)



Why isn't my HTML document linking properly to my CSS file? - craigOwnsYou - Oct 8, 2019

So I try this HTML document I have been working on as presented in the video:

Code
<!DOCTYPE html>

<html>
    <head>
        <meta charset="utf-8">
        <title>Amazon Checkout</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" type="type/css" href="styling.css">
    </head>

    <body>
        <form>
            [b]<!--[/b]
            <label for="address">Address:</label>
            <input type="text" name="address" id="address" placeholder="Address" size="30px" maxlength="100">
            <br />
            <label for="postcode">Postcode:</label>
            <input type="text" name="postcode" id="postcode" placeholder="Postcode" size="30px" maxlength="100">
            <br />
            <label for="city">City:</label>
            <input type="text" name="city" id="city" placeholder="City" size="30px" maxlength="100">
            <p>Choose your shipping method:</p>
            <select name="shipping" id="shipping">
                <option value="Free super saver shipping">Free super saver shipping</option>
                <option value="Two-Day shipping">Two-Day shipping</option>
                <option value="One-Day shipping">One-Day shipping</option>
            </select>
            <p>Choose your payment method:</p>
            <label>Paypal<input type="radio" name="payment" value="paypal"></label>
            <label>Debit Card<input type="radio" name="payment" value="debit card"></label>
            <label>Credit Card<input type="radio" name="payment" value="credit card"></label>
            <br />
            <label for="comments">Comments:</label>
            <textarea rows="4" cols="40" name="comments" id="comments"></textarea>
            <br />
            <label>Sign me up for email updates<input type="checkbox" name="email updates" checked="checked"></label>
            <br />
            <label>Securely save my payment details<input type="checkbox" name="save payment"  checked="checked"></label>
            <br />
            <input type="submit" value="Submit">
          -->
          <div class="container">
            A
          </div>
          <div class="submit">
            B
          </div>
        </form>
    </body>


</html>

And here's the CSS code:

Code
* {
  box-sizing: border-box;
}

body, html {
  margin: 0;
  padding: 0;
}

form {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 10px;
}

.container {
  background-color: greenyellow;
}

.submit {
  background-color: darkred;
  margin-top:auto;
}

Could someone please point out why it doesn't link properly to the CSS code? I really need help with this. I googled it and got someone else who asked and got an answer someone gave to that guy who asked and that person's answer didn't work.

I can't figure out why my CSS code just doesn't quite link.

Why isn't my code linking!? It makes no sense!!!


I fixed it!!!

Part of the css link was wrong.


RE: Why isn't my HTML document linking properly to my CSS file? - Nachfolger - Oct 9, 2019

I see that you fixed it, but I want to make sure it's obvious to everyone else.

Take note of the type attribute.
Code
<link rel="stylesheet" type="type/css" href="styling.css">

Fixed code
Code
<link rel="stylesheet" type="text/css" href="styling.css" />



RE: Why isn't my HTML document linking properly to my CSS file? - de_g3ntl3m4n - Oct 9, 2019

was going to say, gotta love making sure syntax is correct cause one small move everything falls


RE: Why isn't my HTML document linking properly to my CSS file? - Deal - Oct 9, 2019

(Oct 9, 2019 08:29 AM)Crispysandwhich Wrote:  was going to say, gotta love making sure syntax is correct cause one small move everything falls

Agreed. A Capital letter, a wrongly placed space, etc. can cause issues.


RE: Why isn't my HTML document linking properly to my CSS file? - Nachfolger - Oct 9, 2019

(Oct 9, 2019 08:30 AM)Deal Wrote:  Agreed. A Capital letter, a wrongly placed space, etc. can cause issues.
Except, neither of these two things you listed would cause an issue with most HTML elements, let alone a link element.

Valid
Code
<link rel="stylesheet" type="text/css" href="style.css" />

Valid
Code
<LINK rel="stylesheet" type="text/css" href="style.css" />

Valid
Code
<link rel=" stylesheet " type="text/css" href="style.css" />

Valid
Code
<link Rel="stylesheet" type="text/css" href="style.css" />

Heck, even this is valid
Code
<link rel=" Stylesheet " type="text/css" href="style.css" />

Valid
Code
<link rel= "stylesheet" type="text/css" href="style.css" />

You get the point. Don't spew nonsense just to rack posts up.


RE: Why isn't my HTML document linking properly to my CSS file? - Deal - Oct 9, 2019

(Oct 9, 2019 08:41 AM)Nachfolger Wrote:  Except, neither of these two things you listed would cause an issue with most HTML elements, let alone a link element.

Valid
Code
<link rel="stylesheet" type="text/css" href="style.css" />

Valid
Code
<LINK rel="stylesheet" type="text/css" href="style.css" />

Valid
Code
<link rel=" stylesheet " type="text/css" href="style.css" />

Valid
Code
<link Rel="stylesheet" type="text/css" href="style.css" />

Heck, even this is valid
Code
<link rel=" Stylesheet " type="text/css" href="style.css" />

Valid
Code
<link rel= "stylesheet" type="text/css" href="style.css" />

You get the point. Don't spew nonsense just to rack posts up.


I’m talking generally. Not just in relation to one fucking line you giant dumbass.
So a capital letter doesn’t affect selectors? A capital letter does not affect attributes? If his css is called styles.css but he writes Styles.css that doesn’t affect it?

Giant moron. Shut the fuck up who are you even