<li>my car is a bmw</li>
<li>my other car is a tesla</li>
<li>don't I wish</li>
<ul>
<li>chevrolet</li>
<li>pontiac</li>
<li>nissan</li>
</ul>
<ol>
<li>chevrolet</li>
<li>pontiac</li>
<li>nissan</li>
</ol>
</body>
</html>
Here, I am playing with lists and I’ve enclosed a screenshot of the result in the browser.
The first block of code is simply a list.
The second - an unordered list.
The last - an ordered list.
I am wondering whether using - li - ul - ol - automatically outputs the result in italics because I thought that italics are the output ONLY when the list is bracketed by - em - tags. I was expecting a regular font in the lists - the italics were a surprise.
No italics here. Im using the most recent version of chrome on a Macbook Pro with macOS Catalina. The font does look italic a little though, you could use some css to fix that: https://www.w3schools.com/css/css_font.asp
Generally, no. While browsers do have some default styles for different tags (for example <cite> may italicize by default), lists should not do this. If I had to guess, I’d say you have a <i> tag somewhere higher in the document which is making everything italic, maybe a <li> that was missing the “l” from a typo?
No solitary <i> that I can see but there is a lot of stuff above my lines of code so there might be something in there giving me the unwanted italics. I just removed all lines of code above what I have pasted here and yes! - regular fonts - no italics! Yea! So I’m a happy camper now.
Another technique you can use to figure out what is going on is use the browser developer tools. In Chrome, selecting the text via the Elements Panel will show you the applied CSS styles. Below is an example of what the applied styles for the bold usernames on this page are:
I am confused. According to what you have just written, selecting multi lines of code and then pressing the </> button will then make the code readable in a reply. But I thought Senocular said in his reply that 3 bacticks above and below the lines of code are the only way to make the posted code readable in a reply. Unless pressing the number 1 key and then the </> is the equivalent of 3 backticks surrounding your lines of code. I need a bit of straightening out on this.
For code blocks, you can either indent by 4 spaces or use backticks. The button in the editor UI will use indent whereas backticks are easier when typing it all out manually. Backticks also also let you specify a language if you want, giving you a little more control than the indent.
Thanks to you - Kirupa and Senocular - both for pointing out the alternate ways to quote code. I like the Icon - 99% approach but I’ll certainly retain the 3 backticks approach in the back (unintentional pun here) of my mind as well.
The editor I’m showing in the GIF is the same as the one you use to reply to posts on the forums. It is from https://www.discourse.org, whose source code is fully available