admin管理员组

文章数量:1431392

I e to you guys with an issue that I have been trying to solve since the past 4 days . Having spent a lot of time trying to fix the issue although I have found work-arounds I have not solved the problem.

The problem is with List-Styling , specifically List-style:none which I am trying to apply to a list which is not displayed when the page is loaded (display:none).

When the page loads the user can click on a button which should then change the list from none to block displaying the list on the page.

Now this works fine on Chrome , Firefox and IE however for whatever reason when the list displays on Edge it shows bullet points.

I can apply List-style:square , or circle or disc and all of them will be applied however List style None is pletely ignored although I can see it in developer tools .

I have found ways around this ( using visibility instead of display , using list-style-image data 0 which both work .

However I still havnt found a solution for my problem.

My code ( or code I can show ) is as follows..

HTML
    <!DOCTYPE HTML>
    <html xml:lang="en" lang="en">
    <head>

<link rel="stylesheet" type="text/css" href="/css/style.css" />

</head>
<body>
<button onclick="myFunction()">Click Me</button>
<div class="theList" id="myDIV">
    <ul id="theul">
        <li style="list-style: none;">one</li>
        <li>two</li>
        <li>three</li>
    </ul>
</div>
</body>
</html>
<script>
    function myFunction() {
    var x = document.getElementById("myDIV");
    if (x.style.display === "none") {
        x.style.display = "block";
    } else {
        x.style.display = "none";
    }
}
    </script>

CSS

#theul li{
    display: list-item;
    //list-style-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7);
    list-style: none;
}
.theList{
    display: none;
} 

Now using List-style: none inline works like a charm , also Using it in the Head in Style tags also works a charm just external stylesheet which doesnt work.

Hopefully someone can help , and hopefully I havnt confused everyone.

Additional note : I have been unable to replicate the issue on sites like JsFiddle.

I e to you guys with an issue that I have been trying to solve since the past 4 days . Having spent a lot of time trying to fix the issue although I have found work-arounds I have not solved the problem.

The problem is with List-Styling , specifically List-style:none which I am trying to apply to a list which is not displayed when the page is loaded (display:none).

When the page loads the user can click on a button which should then change the list from none to block displaying the list on the page.

Now this works fine on Chrome , Firefox and IE however for whatever reason when the list displays on Edge it shows bullet points.

I can apply List-style:square , or circle or disc and all of them will be applied however List style None is pletely ignored although I can see it in developer tools .

I have found ways around this ( using visibility instead of display , using list-style-image data 0 which both work .

However I still havnt found a solution for my problem.

My code ( or code I can show ) is as follows..

HTML
    <!DOCTYPE HTML>
    <html xml:lang="en" lang="en">
    <head>

<link rel="stylesheet" type="text/css" href="/css/style.css" />

</head>
<body>
<button onclick="myFunction()">Click Me</button>
<div class="theList" id="myDIV">
    <ul id="theul">
        <li style="list-style: none;">one</li>
        <li>two</li>
        <li>three</li>
    </ul>
</div>
</body>
</html>
<script>
    function myFunction() {
    var x = document.getElementById("myDIV");
    if (x.style.display === "none") {
        x.style.display = "block";
    } else {
        x.style.display = "none";
    }
}
    </script>

CSS

#theul li{
    display: list-item;
    //list-style-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7);
    list-style: none;
}
.theList{
    display: none;
} 

Now using List-style: none inline works like a charm , also Using it in the Head in Style tags also works a charm just external stylesheet which doesnt work.

Hopefully someone can help , and hopefully I havnt confused everyone.

Additional note : I have been unable to replicate the issue on sites like JsFiddle.

Share Improve this question edited Jan 4, 2018 at 23:10 PleaseHelpTheNoob asked Jan 4, 2018 at 20:44 PleaseHelpTheNoobPleaseHelpTheNoob 6610 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 4

i had the same problem... its ridiculous, but "white-space:nowrap;" at your li maybe can fix the problem.

I had a similar problem and the "white-space: nowrap" hack worked. More info: I had a UL that was styled list-style: none and was still showing bullets only in IE Edge. I would inspect the element and turn the "list-style: none" rule off and then back on and voila, bullets gone. Adding "white-space: nowrap" to the UL made the bullets not show on first load as intended. Thanks!

you can use "white-space: normal". not fine - but it works.

To fix this bug, just write the following code:

ul li {
list-style:none;
list-style-image:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7);
}

Hope this helps. :)

本文标签: javascriptRemove Bullet points from EdgeStack Overflow