I am working on the JavaScript cash register project.
I have
``
Is the stylesheet for that project named styles.css or something else? I am sure everything I did was saved.
I am working on the JavaScript cash register project.
I have
``
Is the stylesheet for that project named styles.css or something else? I am sure everything I did was saved.
Hi,
I am unsure since you didnât share your code, but did you try styles.css
?
hey, try not to open multiple topics for a single project or step in fcc.
(remember that for next time)
Thatâ what I did. Other lines in the css or HTML shouldnât affect this.
The css is below:
``
body {
margin: 0;
padding: 0;
display: block;
}
h1 {
text-align: center;
margin-bottom: 10px;
}
.purchase-btn, clear-btn {
width: 100px;
height: 60px;
margin-right: 40px;
border-width: 3px;
font-size: 18px;
color:white;
background-color: green;
}
``
post the html too so we can see it
I donât know how that happened. Sorry.
Normally, adding styles.css
to your href should work. But yeah share your HTML too please.
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="styles.css">
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cash Register</title>
</head>
<body>
<h1 class="main-title">Cash Register</h1>
<div class = "input-container">
<label for="cashPaid">Cash</label>
<input value="' name="cash" id="cash" class="cash" type="number">
<button id="purchase-btn" class="purchase-btn">Purchase</button>
<button id="clear-btn" class=">Clear</button>
</div>
<div id="change-due"></div>
<script src="script.js"></script>
</body>
</html>
Try adding your code, then select all and ctrl + e or just use preformatted text from the toolbar. Right now we donât see your code.
Not really my problem, but I will try again.
``
Cash Register``
Iâve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the âpreformatted textâ tool in the editor (</>
) to add backticks around text.
See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').
Ok.
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="styles.css">
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cash Register</title>
</head>
<body>
<h1 class="main-title">Cash Register</h1>
<div class = "input-container">
<label for="cashPaid">Cash</label>
<input value="' name="cash" id="cash" class="cash" type="number">
<button id="purchase-btn" class="purchase-btn">Purchase</button>
<button id="clear-btn" class=">Clear</button>
</div>
<div id="change-due"></div>
<script src="script.js"></script>
</body>
</html>
Your code works perfectly for me ( your link to your styles). The styles apply too, and I donât think there is a problem in that part. Try maybe reloading the page.
looks like you have some errors in this html
Can you fix them all and see if that helps?
https://validator.w3.org/nu/#textarea
Yeah. But there is an inconsistentency. The HTML in the guided lessons and all og the responsivve Web Design lessons and projects have the closing forward slash on self-closing âvoidâ tags. It was how I was taught.
Why is the code validator flagging this as an error?
the validator should mention why.
It is not important for this test but in general I donât use the closing slash myself on self-closing elements.
(also I think it is tagging those as âinfoâ not âerrorâ)
Thede didnât seem be marked as warnings. There were other things in the errata that seem to indicate a different release of HTML.
when I try I see they are marked as info. You have other more serious issues to fix.
Info: Trailing slash on void elements has no effect and interacts badly with unquoted attribute values.
From line 6, column 3; to line 6, column 26
s.css">â© <meta charset="UTF-8" />â© <me
Info: Trailing slash on void elements has no effect and interacts badly with unquoted attribute values.
From line 7, column 3; to line 7, column 57
F-8" />â© <meta http-equiv="X-UA-Compatible" content="IE=edge" />â© <me
Info: Trailing slash on void elements has no effect and interacts badly with unquoted attribute values.
From line 8, column 3; to line 8, column 74
dge" />â© <meta name="viewport" content="width=device-width, initial-scale=1.0" />â© <ti
Ok. I saw XML 1.0 mentioned in the errata. Yes, I was incorrect. Those entries were marked as"info". Thank you.
I corrected the code and got a new set of errors that seem out of context. The code and errata are below. I edited to keep only the errors and warnings for briefness.
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="styles.css">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cash Register</title>
</head>
<body>
<h1 class="main-title">Cash Register</h1>
<label for="cash">Cash</label>
<input value=0 name="cash" id="cash" class="cash" type="number">
<button id="purchase-btn" class="purchase-btn">Purchase</button>
<button id="clear-btn" class=">Clear</button>
<div id="change-due"></div>
<script src="script.js"></script>
</body>
</html>
Error: No space between attributes.
At line 16, column 12
on>â©
Error: Quote " in attribute name. Probable cause: Matching quote missing somewhere earlier.
At line 16, column 22
id=âchange-dueâ>
Warning: Attribute change-due" is not serializable as XML 1.0.
From line 15, column 3; to line 16, column 23
button>â© <button id=âclear-btnâ class=">Clear
Error: Attribute change-due" not allowed on element button at this point.
From line 15, column 3; to line 16, column 23
button>â© <button id=âclear-btnâ class=">Clear
Error: Stray end tag div.
From line 16, column 24; to line 16, column 29
ange-due"> <sc
Error: End tag for body seen, but there were unclosed elements.
From line 18, column 1; to line 18, column 7
</htm
Error: Unclosed element button.
From line 15, column 3; to line 16, column 23
button>â© <button id=âclear-btnâ class=">Clear
Line 16, div with id of âchange-dueâ:
No space BETWEEN attributes: There is only one attribute. Between indicates that there are two.
Quote in attribute: I found that all of my quotes are matched. The attribute is supposed to be quoted.
My button tags and body taghave both opening and closing
âchange-dueâ on element button might be happening because of other errors.
Again, I had the validator set for HTML5. Why is it always confounding the evaluation with XML1?
It is frustrating and confusing. Can you help me to understand this. It doesnât add up.