My css code in Word Press is working for every other page in the website when i only want it to work for 1 page

Related searches

I have currently made a code in CSS, which I wanted for a particular page but unfortunately, it is working for every other page as well and it makes the other pages look quite broken since the formatting of them goes very odd.

The solutions I have tried so far are:

Using the unique code of the page and making it something like this - * .post-id-17 .stop {code here} But I got no results from using this solution.

Here is the HTML code:

<!DOCTYPE html>
<html>
<head>
    <title>CountDown</title>
    <link rel="stylesheet" type="text/css" href="style.css">
    <link href="https://fonts.googleapis.com/css?family=Poppins&display=swap" rel="stylesheet">
</head>
<body>
    <header>
        <h1>CountDown</h1>
    </header>
    <div class="content">
        <div class="counter"></div>
        <input type="number" id="seconds" placeholder="Seconds">
        <div class="buttons">
            <button class="btn start" id="start" value="1" onclick="check(this)">Start</button>
            <button class="btn start" id="continue" value="1" onclick="check(this)">Continue</button>
            <button class="btn stop" id="stop" value="0" onclick="check(this)">Stop</button>
            <button class="btn start" id="ok" onclick="toSubmit()">Submit</button>
        </div>
    </div>
    <script type="text/javascript" src="main.js"></script>

</body>
</html>

Here is the CSS code:

* .post-id-706 .stop {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

html, body{
    height: 100%;
}
body{
    width: 100%;
    height: 100%;
    background: linear-gradient(to left top, #0045D6, #00A9f6);
}

header{
    width: 100%;
    height: 13vh;
    background-color: #fff;
    color: #0045F6;
    display: flex;
    justify-content: center;
    align-items: center;
}

.content{
    width: 100%;
    height: 60vh;
    font-size: 3rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.content #seconds{
    width: 250px;
    font-size: 2rem;
    padding: 1rem;
    outline: none;
    background: none;
    border: none;
    border-bottom: 3px solid #fff;
    color: #000000;
}

#seconds::placeholder{
    color: #ddd;
    font-size: 1.7rem;
}

.btn{
    background-color: #fff;
    border-radius: 4px;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 0.8rem 1.7rem;
    font-size: 1.2rem;
    font-weight: 700;
}

.start{
    color: #1f0;
}

.stop{
    color: #E00;
}

#start, #stop, #continue{
    display: none;
}

.counter{
    color: #000000;
}

Here is the javascript code:

const container = document.querySelector('.counter');
const buttonsDiv = document.querySelector('.buttons');
const secInput = document.getElementById('seconds');

var seconds;
var remseconds;
var minuts;
var toCount = false;

function toSubmit(){
    display('start');
    remove('seconds');
    remove('ok');
    seconds = Number(secInput.value);
    counting();
}

function display(e){
    document.getElementById(e).style.display = 'block';
}

function remove(e){
    document.getElementById(e).style.display = 'none';
}

function check(stat){
    if(stat.id == "start"){
        display("stop");
        remove("start");
        toCount = true;
    }
    else if(stat.id == "stop"){
        display("continue");
        remove("stop");
        toCount = false
    }
    else{
        display("stop");
        remove("continue");
        toCount =true;
    }
}

function count(){
    if(seconds > 0){
        if(toCount == true){
            seconds--;
            remseconds = seconds % 60;
            minuts = Math.floor(seconds / 60);

            if(minuts < 10){
                minuts = "0" + minuts;
            }

            if(remseconds < 10){
                remseconds = "0" + remseconds;
            }

            container.innerHTML = minuts + " : " + remseconds;
        }
    }
    else{
        container.innerHTML = "DONE!";
        buttonsDiv.style.opacity = "0";
    }
}

function counting(){
    remseconds = seconds % 60;
    minuts = Math.floor(seconds / 60);


    if(remseconds < 10){
        remseconds = "0" + remseconds;
    }

    container.innerHTML = minuts + " : " + remseconds;
    setInterval(count, 1000);
}   

If you have any ideas in order to solve this issue please let me know.


You can add a class to the page where you want to apply CSS, and change all CSS with reference to that class. for example:

<html class="some-class">
...<your code>
</html>

CSS:

.some-class <your-selector>{
    <your css>
}

Internal CSS on WordPress page?, Could it be on a single WordPress “edit page” and implemented but not seen on You can add styles for that class, if you want it to affect only that page. Put the CSS in the Additional CSS section of the Customizer (or use a plugin if I'm trying to figure out why my CSS is showing up on the page where everyone can see,� We show you top results so you can stop searching and start finding the answers you need. Find word press web site on AllSearchSite.com


You can also add a single CSS file with those contents to a single page, specifying a condition in PHP like so in the <head>:

<?php
    if (is_page(id-of-the-page)) {
?>
    <link rel="stylesheet" href="/path/to/stylesheet.css" />
<?php
    }
?>

Just make sure to set the correct ID of the page.

How to Easily Add Custom CSS to Your WordPress Site, First, you need to head over to the Themes � Customize page. Note: Any custom CSS that you add using theme customizer is only available with that particular theme. If you would like to use it with other themes, then you will need to You can now view your WordPress website to see the custom CSS in� Find Word Press Website Here with us! Search For Word Press Website Here.


Here is the HTML code:

<!DOCTYPE html>
<html class="class2">
<head>
    <title>CountDown</title>
    <link rel="stylesheet" type="text/css" href="style.css">
    <link href="https://fonts.googleapis.com/css?family=Poppins&display=swap" rel="stylesheet">
</head>
<body>
    <header>
        <h1>CountDown</h1>
    </header>
    <div class="content">
        <div class="counter"></div>
        <input type="number" id="seconds" placeholder="Seconds">
        <div class="buttons">
            <button class="btn start" id="start" value="1" onclick="check(this)">Start</button>
            <button class="btn start" id="continue" value="1" onclick="check(this)">Continue</button>
            <button class="btn stop" id="stop" value="0" onclick="check(this)">Stop</button>
            <button class="btn start" id="ok" onclick="toSubmit()">Submit</button>
        </div>
    </div>
    <script type="text/javascript" src="main.js"></script>

</body>
</html>

Here is the CSS code:

.class2 .content{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

.class2 html, body{
    height: 100%;
}
.class2 body{
    width: 100%;
    height: 100%;
    background: linear-gradient(to left top, #0045D6, #00A9f6);
}

.class2 header{
    width: 100%;
    height: 13vh;
    background-color: #fff;
    color: #0045F6;
    display: flex;
    justify-content: center;
    align-items: center;
}

.class2 .content{
    width: 100%;
    height: 60vh;
    font-size: 3rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.class2 .content #seconds{
    width: 250px;
    font-size: 2rem;
    padding: 1rem;
    outline: none;
    background: none;
    border: none;
    border-bottom: 3px solid #fff;
    color: #000000;
}

#seconds::placeholder{
    color: #ddd;
    font-size: 1.7rem;
}

.class2 .btn{
    background-color: #fff;
    border-radius: 4px;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 0.8rem 1.7rem;
    font-size: 1.2rem;
    font-weight: 700;
}

.start{
    color: #1f0;
}

.stop{
    color: #E00;
}

#start, #stop, #continue{
    display: none;
}

.counter{
    color: #000000;
}

WordPress: Customize the CSS for specific pages or posts , In order to target the CSS on the homepage specifically you can use the class . home . have an image which displays in the header of every page of your website. example, how could we target only the Blog page and no other page or post? Each page in WordPress has a specific class added to its <body> element� Search a wide range of information from across the web with Simpli.com. Word Press Website. Visit Today & Find More Results on Simpli.com.


How to Make A CSS Change to A Single Page in WordPress, All you have to do is signify the page id number in your CSS. you can go full steam ahead in my Web Design Crash Course for Creative Bloggers. Use Inspect Element to find your page ID to make CSS style changes to a single the code that you want your style change to only affect that specific page. Save time Searching at MyDeal. Search For Word Press Web Site with us!


Methods for Overriding Styles in WordPress, It just works great and your website looks wonderful. On one hand, any stylesheets a plugin includes need to be opinionated enough so that they On the other hand, they need to respect the work of the active theme and other plugin We could get a little more fancy by telling WordPress to load it only on a specific page: You see, that’s the “Cascading” part of “Cascading Style Sheets”, aka CSS. Here’s another example. Let’s say I want to make all of my H2 elements red and all my P elements blue. I might do this: H2 {color: red;} p {color: blue;} But if I then styled the H2 to be orange, later in the same stylesheet, then ALL my H2’s would be orange.


Now I want to style that text with css, which is working perfectly on the landingpage. The problem is, that the css is seemingly only working on full width templates, but not on pages with the standard template (e.g. the Blog site). Here all css styling is working excpt for the font, it only loads the fallback font. Here the css I’m using: