I need to add a style to my checkbox so that it looks like this:
this is my code:
<input type="checkbox" data-role="flipswitch" name="switch" id="switch">
I tried to put this code, but it uses libraries and if I add it to my project the css of the page is damaged:
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="main" class="ui-content">
<form method="post" action="/action_page_post.php">
<label for="switch">Flip Toggle Switch:</label>
<input type="checkbox" data-role="flipswitch" name="switch" id="switch">
<br>
<input type="submit" data-inline="true" value="Submit">
</form>
</div>
</div>
</body>
Take a look at this example taken from Codepen , using only CSS.
You can ignore the background image or change it to another of your choice.
Codepen is like an online bookstore where you can find interesting code snippets that help us learn ways to get the most out of using HTML/CSS, combined or not with Javascript.
You can do it in the following way:
Good morning friend,
You can do it in the following way too
I see that you use boostrap, so that can help you
With CSS3 you can do it... here are some examples:
the html
the css3
and js