Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.6k views
in Technique[技术] by (71.8m points)

html - Django- VSCode - css loaded from static files "sticks" and does not respond to editing

Well this one is a head scratcher for me. I create a class in my style.css static file:

.not-visible {
    display:none;
    margin-top: 10px !important 
}

I then apply this class to a button and the button disappears

<div id = "btn-box" class = "not-visible">
            <button type = "submit" class = "ui primary `button">save</button>`
        </div>

I then edit my static css file to remove the display:none attribute to see if the button is visible again.

    .not-visible {
           margin-top: 10px !important 
}

After performing this operation, saving the css file, reloading the server, and restarting my web browser, the button is still no visible even though I deleted that property. When I delete the not-visible class in the button div, the button becomes visible gain.

if I repeat this exercise, except I code the css directly into the html file, to button disappears and reappears as expected when I add and then delete the display:none property. So my question is, howcome saved changes to static css files do not apply to my html file?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Just Add semicolon ; and try to remove !important as following:

.not-visible {
    margin-top: 10px;
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...