+ 1
Making something italic with color
I just started learning html and css. I have been able to add a color to text and i have been able to make text italic, but not both at the same time. How would i go about achieving this? I am very new to coding.
6 ответов
+ 1
https://code.sololearn.com/W5jQsUW1uYFW/?ref=app
Look twice
One thing to remember, when you post such question - don't forget show your tries. If you don't show your attempts, there's very little chance that someone will help you.
+ 2
Here is my first practice code. Its literally just what ive been messing around and experimenting with. I just tried what you showed me and it worked. Youll see im messing around trying a few different things ive been learning.
https://code.sololearn.com/WY39MeiBJz1k/?ref=app
+ 2
Thanks Janning! I think that helped my terminology out a bit
+ 1
Thanks for the advice. I think you helped answer my question. From looking at your code you made both the color and italic font in the same css element? Im still new to the terminology too so element might be the wrong word.
I was trying to do them as 2 separate elements and then adding both into the html script
+ 1
Ryan Lusby you have some options.
HTML has elements (denoted by tags, which happen to start and end with <>) which have attributes which have properties which have values. For example:
<p id="first" class="zesty chicken" style="color: red; font-style: italic;">SoloLearn tastes better than ever!</p>
This is a paragraph element with three attributes (id, class, style). Style has two properties (color, font-style) and each of those properties has one value (red / italic respectively). The confusing part is that id has one "value" when viewed from the HTML file, but can refer to a set of "rules" in the CSS file (or in the style element of you have not separated the CSS into its own file). From the CSS file, the id value or class values are referred to as "selectors" ( https://www.w3schools.com/css/css_syntax.asp ) and each rule-set has properties and values (generally in pairs).
Clear as mud?
Best practice, in general, is to have a separate/external stylesheet (CSS file) and not use internal or inline styles
0
Can you show what you did?