Making something italic with color | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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.

17th Nov 2018, 2:41 PM
Ryan Lusby
Ryan Lusby - avatar
6 Answers
+ 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.
17th Nov 2018, 2:51 PM
Roneel
Roneel - avatar
+ 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
17th Nov 2018, 3:09 PM
Ryan Lusby
Ryan Lusby - avatar
+ 2
Thanks Janning! I think that helped my terminology out a bit
18th Nov 2018, 11:35 AM
Ryan Lusby
Ryan Lusby - avatar
+ 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
17th Nov 2018, 2:59 PM
Ryan Lusby
Ryan Lusby - avatar
+ 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
18th Nov 2018, 10:37 AM
Janningā­
Janningā­ - avatar
0
Can you show what you did?
17th Nov 2018, 3:02 PM
Roneel
Roneel - avatar