+ 1
On to CSS
When doing CSS, does codes have to be written in both HTML and CSS?
14 RĂ©ponses
+ 4
Tyler Eavey In that code, your CSS is not taking effect.
You have this:
body{
p.fantasy
font-family:Blippo,fantasy;
}
_____________________________
Instead put it like this:
body{
}
p.fantasy {
font-family:Blippo,fantasy;
}
You dpnât need to wrap the other elements inside body{} in css.
each element get their own.
example:
body { ... }
.container { ... }
main { ... }
+ 5
Tyler Eavey
In that code, you're using wrong property
font-family property is used to change font type like Arial or Sans etc.
You have to use font-style property in order to make text italic.
+ 4
CSS classes are applied to html tags.
So technically yes, to see CSS codes' effect you should have HTML.
+ 2
Tyler Eavey âitalicâ is not font-family. Thatâs a font-style.
So ... to accomplish the italic effect, you would use...
font-style: italic
+ 1
I am having so much trouble with the CSS code changing the look of my website.
Example: <p class="italic">I am cool.</p>
CSS:
p.italic{
font-family:italic;
}
Would this be wrong?
+ 1
yeah. The CSS will style the HTML.
So if there is no html thereâs nothing to style.
+ 1
Tyler Eavey it should be
p.italic{
font-style: italic;
}
+ 1
How would I section it off so I can have different fonts across the page?
+ 1
1. A quick fix
https://code.sololearn.com/WtP1lmWmu39r/?ref=app
2. Explanation
Apart from what Ginfio and others has pointed out, your code still has one improvements and two mistakes.
(The line number below refers to line number in my fix for you)
Comment 1 (CSS line 7)
.fantasy, no need p
Comment 2 (CSS line 14)
blippo is local machine font, do not use it, use google fonts instead
Comment 3 (HTML line 18)
Link to Google Fonts style sheets
https://fonts.google.com/
Comment 4 (HTML line 8)
<head> is not for content!!!!!!
All content must be in <body>
<head> is for meta content for browsers and search engine.
0
Can you look at my code?
0
Cause I don't what you mean.
0
Tyler Eavey to put them in sections,
.. wait , first what are your sections going to be?
btw, the font for the valuable lessons will work if you took the p.fantasy out of the body {}
https://code.sololearn.com/W0tfYw7wLI9N/?ref=app