Day # 44: Read more



At times, showing too much information on a website may be misleading for people who visit the website. An efficient tactic is to allow the visitor to display more information if he/she wishes to view it. Hence, there is a popular button typically called “Read More/Less”.

I thought it’d be a good way to practice CSS with a website that featured that button mentioned above. The key here is to use an input type=checkbox that uses its label to show the content within the button and the input itself to either show or hide the content of the paragraph.


Then, we can set its content by using the pseudo class of before:

label:before {

    content: "Read More";

}


And when that input is clicked, then we can change the content within the button:


input[type="checkbox"]:checked ~ label:before {

    content: "Read Less";

}


Comments

Popular posts from this blog

Day # 35: Flip Book

Day # 1: Homepage w/Introduction

Day # 8: Inspiration