I am creating my first project. For my tribute page I’m explaining some basic poker strategies based on one of my favorite players. I am frequently using the entities for creating the poker suit symbols (i.e. ). For the hearts and diamonds though, I am styling them with the color red. At first, i was styling them inline but from what I’ve read this is considered sloppy. Then I decided to make a class (.text-red) and created a span to cover the entity like this:
| = < and > (sorry I’m not sure how to post code without it being read by the browser)
<span class="text-red">♥</span>
While this does work, I feel like it still looks sloppy and makes the code look clustered as they’re sprinkled through out my ‘p’ elements. Is there a way that I can make that span with the entity be summoned within the paragraph element and be styled in a more compact and cleaner method? I was trying to do this with jQuery by using the document ready function with .html but it doesn’t seem to work. For example:
(document).ready(function() {
$("diamond").html("<span class="text-red">♥</span>")
});
From my understanding, which could be wrong, all I would have to do then is insert an element (this is what I’m lacking?) with the class .diamond where ever I wanted to have a red colored diamond appear within my ‘p’ element. I tried using a ‘span’ with class=“diamond” with the expectation that when executed, any text within the ‘span’ element would be removed and replaced by the string shown above proceeding the .html.
Am I overthinking this? Is my second method (text-red) of styling the proper or correct way to code this? Any suggestions or tips would be great!
I’m not sure how to link my codepen project to this page. If anyone could help me with that as well I will gladly share my project for further review. In the mean time I’m going to continue to try and find a solution on my own. Thank you for reading!