Pure CSS read more toggle

Size
2,344 Kb
Views
161,920

How do I make an pure css read more toggle?

What is a pure css read more toggle? How do you make a pure css read more toggle? This script and codes were developed by Kasper Mikiewicz on 21 November 2022, Monday.

Pure CSS read more toggle Previews

Pure CSS read more toggle - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Pure CSS read more toggle</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ .read-more-state { display: none;
}
.read-more-target { opacity: 0; max-height: 0; font-size: 0; transition: .25s ease;
}
.read-more-state:checked ~ .read-more-wrap .read-more-target { opacity: 1; font-size: inherit; max-height: 999em;
}
.read-more-state ~ .read-more-trigger:before { content: 'Show more';
}
.read-more-state:checked ~ .read-more-trigger:before { content: 'Show less';
}
.read-more-trigger { cursor: pointer; display: inline-block; padding: 0 .5em; color: #666; font-size: .9em; line-height: 2; border: 1px solid #ddd; border-radius: .25em;
}
/* Other style */
body { padding: 2%;
}
p { padding: 2%; background: #fff9c6; color: #c7b27e; border: 1px solid #fce29f; border-radius: .25em;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <div> <input type="checkbox" class="read-more-state" id="post-1" /> <p class="read-more-wrap">Lorem ipsum dolor sit amet, consectetur adipisicing elit. <span class="read-more-target">Libero fuga facilis vel consectetur quos sapiente deleniti eveniet dolores tempore eos deserunt officia quis ab? Excepturi vero tempore minus beatae voluptatem!</span></p> <label for="post-1" class="read-more-trigger"></label>
</div>
<div> <input type="checkbox" class="read-more-state" id="post-2" /> <ul class="read-more-wrap"> <li>lorem</li> <li>lorem 2</li> <li class="read-more-target">lorem 3</li> <li class="read-more-target">lorem 4</li> </ul> <label for="post-2" class="read-more-trigger"></label>
</div>
</body>
</html>

Pure CSS read more toggle - Script Codes CSS Codes

.read-more-state { display: none;
}
.read-more-target { opacity: 0; max-height: 0; font-size: 0; transition: .25s ease;
}
.read-more-state:checked ~ .read-more-wrap .read-more-target { opacity: 1; font-size: inherit; max-height: 999em;
}
.read-more-state ~ .read-more-trigger:before { content: 'Show more';
}
.read-more-state:checked ~ .read-more-trigger:before { content: 'Show less';
}
.read-more-trigger { cursor: pointer; display: inline-block; padding: 0 .5em; color: #666; font-size: .9em; line-height: 2; border: 1px solid #ddd; border-radius: .25em;
}
/* Other style */
body { padding: 2%;
}
p { padding: 2%; background: #fff9c6; color: #c7b27e; border: 1px solid #fce29f; border-radius: .25em;
}
Pure CSS read more toggle - Script Codes
Pure CSS read more toggle - Script Codes
Home Page Home
Developer Kasper Mikiewicz
Username Idered
Uploaded November 21, 2022
Rating 4.5
Size 2,344 Kb
Views 161,920
Do you need developer help for Pure CSS read more toggle?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Kasper Mikiewicz (Idered) Script Codes
Create amazing web content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!