The list items are showing incorrect characters when displayed in UTF-8 format

I'm attempting to create a style that will display an arrow in place of the li element.

$("html > head").append("<style id=styles>div#panel { position: absolute; border-radius: 3px; font-family:'Arial Black'; font-size:13px; }\n\r" +
     "ul li:before { content: \"\00BB \8680\"; }"
    + "</style>\n\r");

Instead of seeing an arrow, I'm only getting a jumble of characters displayed. The page charset is utf-8.

I've reviewed these resources: http://www.w3schools.com/charsets/ref_utf_arrows.asp

Any suggestions on how to resolve this issue?

Answer №1

Here's a simple trick. Just update content: \"\00BB to content: '\\00BB'.

Example in Action:

$(function() {
  $("html > head").append("<style>div#panel{ position: absolute; border-radius: 3px; font-family:'Arial Black'; font-size:13px; } ul { list-style: none; } ul li:before{ content: '\\00BB'; margin-right: 10px; } </style>");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ul>
  <li>Some text</li>
  <li>Some text</li>
  <li>Some text</li>
  <li>Some text</li>
</ul>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Aligning to the left using a .css file in RMarkdown has some limitations

In my .css file, I have the following code: .column-left{ float: right; height: 100%; width: 100%; text-align: left; } After that, I apply it to RMarkdown like this: <div class="column-left"> This is an example sentence. * Anothe ...

Adjust the size of the text editor in eXtplorer's EditArea module

Looking for guidance on adjusting the height of the text editor (EditArea) within eXtplorer. Any assistance would be greatly appreciated! ...

Dynamic content in a CSS animation that rolls credits as they scroll

Currently, I'm working on creating a credit scrolling effect that pulls data from the JustGiving API to display a list of donors. I have successfully populated the list of donors and connected to the API without any issues. However, the challenge lies ...

What methods can be used to ensure all widgets are aligned in a single line using html or css?

The code located at the end is functioning properly except for widget alignment, as shown in the image below. Do you have any suggestions on how to align all widgets together in a straight line (excluding the necessary wrapping which is currently working w ...

"The Issue with Dropdowns in Older Versions of Internet Explorer (IE8 and Below

Greetings! I recently revamped my website to include drop-down menus, but unfortunately, I discovered that in IE 8 and earlier versions, the display is far from ideal. The menus appear correctly on all other browsers except for Internet Explorer. I have b ...

Ways to customize the default font in themes by using locally stored fonts

Currently, I am utilizing Quarto for the creation of a website and attempting to modify the default fonts within a specific theme. My ultimate objective is to incorporate local Google fonts rather than relying on the Google API. In my _quarto.yml file, it ...

Ways to widen the header to fit the entire page?

I'm having trouble stretching my header to fill the entire page. I've tried using margin-left and right, but it's not working as expected. My Header CSS: background: green; height: 70px; width: 100%; display: flex; just ...

Remove the triangle shape from the div and reveal the background

Is it possible to use CSS tricks to cut a triangle out of a div and show the background behind it? I didn't think this was achievable, but I know you pros can surprise me. Here's what I'm aiming for: Please don't suggest a 3-column sol ...

JavaScript obtain scroll position of a child element

I have a setup that looks something like the following: <div> <div id="scrollID" style="height:100px;"> content here </div> </div> <script> document.getElementById("myDIV").addEventListener("touchstart", m ...

What are some effective ways to optimize my Javascript and CSS files for a smaller size?

For those dealing with a high volume of Javascript and CSS files, what strategies are recommended for minimizing file sizes? ...

The text in my image is positioned away from the top

Hi there, I am new to exploring HTML and CSS and I have been trying to display some images and text on a webpage. My goal was to have the text appear next to the image, which is working fine. However, I am encountering an issue where the text aligns itself ...

Tips for Arranging HTML Elements Next to Each Other with CSS3

As a beginner in programming, I am embarking on the task of creating a basic website inspired by a dribble design. I am currently struggling to align an image and text side by side within a section, so that they stack on top of each other when the screen ...

Customizing Background Color in React Bootstrap Table Based on Value

Having a little issue that's causing me some trouble. I have a React Bootstrap Table displaying data from an API, and I'm looking to enhance it by changing the row color to green if a specific value is greater than zero. Here is an example: const ...

Adjusting the alignment of text towards the right side

I've been experimenting with various positioning codes to shift the text to the right, but it seems that the CSS isn't recognizing the code properly. Screenshot: https://gyazo.com/6f9cc34d8ed6d33fde401b6317be3a3e .portal .icons a { positi ...

What could be causing my backend to malfunction while the website is live?

Currently, I am working on a PHP5 dynamic site where content such as galleries and news can be added from the backend. Everything was functioning perfectly fine on my localhost, but when I uploaded it online, the dynamic part stopped working. The default P ...

Select all feature in checkbox is malfunctioning

I need to implement a feature with 3 checkboxes: When the "A" checkbox is clicked, only "A" should be highlighted. Upon clicking the "C" checkbox, only "C" gets highlighted. If the "B" checkbox is clicked, both "A" and "B" nee ...

calculation of progress bar advancement

I want to make the progress bar in my game responsive to changes in the winning score. Currently, it moves from 0% to 100%, which is equivalent to 100 points - the default winning score. But I need the progress bar to adjust accordingly based on the user-i ...

The height of the href is not displaying correctly when the text-decoration is disabled and it is placed next to

In my design, I have a link positioned next to an image with perfect vertical alignment. Everything looks great when the text has the standard text-decoration, centered vertically and all that. However, as soon as I remove the text-decoration, leaving the ...

Stop click event from firing on a disabled tree node within an angular custom directive template

In the browser, my custom Angular tree component is displayed like this: + Parent 1 + Child 1-A - Child 1-A-A - Child 1-A-B - Child 1-A-C + Child 1-B + Child 1-C This is what the directive template looks like: <ul> &l ...

The alignment of my text appears to be off

I am facing an issue with the second <ul> on my webpage, which contains more content compared to the first one. In this second <ul>, the last line is appearing floated to the left and does not appear below the penultimate line as expected. Li ...