Skip to content
This repository has been archived by the owner on Nov 23, 2023. It is now read-only.

Gnkalk/Vanilla-ToggleDark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vanilla ToggleDark

Demo

FOSSA Status

FA

You can also create a Dark Mode button without JS 🌞🌜

You may ask how? The purpose of this repo is also to explain this issue to you so that you may create a website with less JS :)

Well, to do this in the html section, you must first create an input button to get the user input, but you are not going to get the input through this button.

<input type="checkbox" id="dark">

Tip Place the input tag at the beginning of the wind so that you can later darken all parts of the html file.

You can give two types of radio or checkbox to the input, but we only explain the checkbox method here.

Well, after that you have to create a label tag to manipulate the checkbox using it.

<label for="dark">

Set the label on the checkbox idi and put it inside the content (moon and sun icon or ..)

Well, then CSS create a CSS file and link to your HTML file.

Now, in the first step, completely hidden the checkbox.

input#dark {
    position: absolute;
    visibility: hidden;
}

Well, we have to get to the heart of the matter, using: Checked to give the rest of the items a very comfortable and stylish style. You can also use ~ it to modify the sidebar, however, if you have not noticed yet, there is a demo here for good understanding =))

License

FOSSA Status


Created By Gnkalk © 2021