CSS font color style not applied [closed] - html

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
Why is the font color for paragraph text not changing to red?
I haven't applied any other CSS styles, so this shouldn't be an issue with style overriding right?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
p {
color=red;
}
</style>
</head>
<body>
<p id="msg1">message 1</p>
</body>
</html>

color: red; would be the correct CSS-syntax. Good luck!

CSS syntax error...
use ':' instead of '=' inside the style..

You have an error in your CSS syntax.
<style>
p {
color: red;
}
</style>
You could also target with the ID by using
<style>
#msg1 {
color: red;
}
</style>

Related

CSS Font Not Formatting [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I am beginning to code in HTML and CSS, and am using the FreeCodeCamp tutorials to help me. Along with my learning I am creating a simple webpage of my own as a project to work on.
Having learnt how to use fonts from the Internet in my webpage, I tried to change the font, colour and size of my header, but when I run the code, this doesn't show up on my webpage.
If it helps, I am using PyCharm for this (I'm not really sure what IDE to use- and I already use PyCharm so I though I'd continue with that).
<link href="https://fonts.googleapis.com/css?family=Lobster"
rel ="stylesheet" type="text/css">
<style> <!--Why doesn't this work?-->
h1 {
font-family: Lobster;
font-size: 50px:
color: red;
}
</style>
<body>
<h1> This is the h1 text which should be formatted.</h1>
your CSS comment is wrong /* CSS Comment */
<link href="https://fonts.googleapis.com/css?family=Lobster"
rel ="stylesheet" type="text/css">
<style> /* Why doesn't this work? */
h1 {
font-family: Lobster;
font-size: 50px;
color: red;
}
</style>
<body>
<h1> This is the h1 text which should be formatted.</h1>
</body>
https://jsfiddle.net/lalji1051/x0odt5qk/2/
There is an error in your css at this line: font-size: 50px: should be ; instead of : at the end of line.

Basic HTML and CSS banner [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 5 years ago.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Improve this question
With the example HTML / CSS below, I cannot work out why this doesnt display the expected results in any browser (hosted in Visual Studio), however works perfectly when done as a JSFiddle. I'm probably missing something pretty obvious, but can anyone point out what that might be?
HTML:
<body>
<div class="wrapper">
<div class="navbar">
<p>Random white text which should appear in a grey banner at the top of the page.</p>
</div>
</div>
</body>
CSS:
body {
width: 100%;
margin: 0;
}
.wrapper {
display: table;
width: 100%;
}
.navbar {
width: 100%;
height: 200px;
background-color: #292929;
color: #ffffff;
text-align: center;
vertical-align: middle;
display: table-cell;
}
EDIT: I have tried this in various different browsers, including Firefox, Direfox Dev Edition, Edge, and IE, all with the same results (just plan black text on white screen).
Make sure to link your css file to your html file.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
...

Css style is not applied in Firefox [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
This is very dumb question. But I do not know how to solve the issue.
I have the following html/css code
<!DOCTYPE html>
<html>
<head>
<title>Selectors and Grouping</title>
<style type=”text/css”>
p {
font-family: Arial;
font-size: 14pt;
}
h1 {
color: black;
border: 5px solid black;
}
h2 {
color: orange;
border: 4px solid orange;
}
h3 {
color: blue;
border: 3px solid blue;
}
h1,
h2,
h3 {
letter-spacing: 5px;
padding: 10px;
}
</style>
</head>
<body>
<h1>
Heading 1
</h1>
<h2>
Heading 2
</h2>
<h3>
Heading 3
</h3>
<p> Selectors choose the element to apply formatting to. grouped together.
</p>
</body>
</html>
html headings must be enclosed in boxes and have different colours. However, when I open the document in Firefox browser it displays the page without any style applied. Online validators point to no error. So the issue must be related to firefox. Can anybody help me?
Thanks in advance.
The issue comes from this part :
<style type=”text/css”>
Your quotes are not the good ones. Use :
<style type='text/css'>
You have following errors :
1) There were incorrect quotes in <style type=”text/css”>. Change it to proper double quote:
<style type="text/css">
2) You are missing one < in doctype declaration as per above code you have mentioned in question.
3) You haven't closed the <html> tag
look at your style tag :
<style type=”text/css”>
change to normal double quote
<style type="text/css">
and close you html tag at the end

Why can't I style my paragraph with css padding? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I'm a newbie to html and CSS, and I've been trying to style my paragraph to have 5px of padding on each side of the text, but whenever I add "padding: 5px;" it gets rid of the background colour (of the paragraph), and the padding makes no effect. I've tried with just the padding and that doesn't work either. Thank you in advance!
HTML and CSS for reference:
body {
background-color: #000000;
font-family: arial;
color: white;
}
a {
color: orange;
}
p {
background-color: #393939
padding: 5px;
}
<!doctype html>
<html>
<head>
<title>spam</title>
</head>
<body>
<link rel = "stylesheet" href="main.css">
<img src = "">
<h1><strong>Website name</strong></h1>
<ul>
Home
News
</ul>
<p>
Man stabbed in ...
</p>
</body>
</html>
In CSS you need to end each property you add with a ; so simply change the code to:
p {
background-color: #393939;
padding: 5px;
}
Not having the ; to show that a property ended meant the browser read the CSS as one big property that doesn't exist, which is why it seemed like your CSS did nothing.
You are missing the ; after background-color: #393939

CSS in the head is showing up on the page [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css.css">
.green {
color: green;
font-size: 2em;
}
</head>
This is my entire head, the
.green {
color: green;
font-size: 2em;
}
Is showing up at the top of the webpage.
I have Googled this but cannot find a fix, apparently only things in the body should show up on the page.
Anyone know how to fix?
If you wish to place styling within your HTML document, you need to wrap it within a style element:
<head>
...
<style type="text/css">
.green {
color: green;
font-size: 2em;
}
</style>
</head>
Depending on what you're trying to do, however, you could just add this to your existing css.css file which your link element includes on your page.
you linked yourpage to a css.css file
you either add your css code into that file, or you add the <style></style> to wrap your code so that it would be processed as style
Add style tag to it
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css.css">
<style>
.green
{
color: green;
font-size: 2em;
}
</style>
</head>