FAQ PAGE

FAQ'S

What is an FAQ Page?

Lorem ipsum dolor, sit amet consectetur adipisicing elit. Velit saepe sequi, illum facere necessitatibus cum aliquam id illo omnis maxime, totam soluta voluptate amet ut sit ipsum aperiam. Perspiciatis, porro!


Why do you need an FAQ page?

Lorem ipsum dolor, sit amet consectetur adipisicing elit. Velit saepe sequi, illum facere necessitatibus cum aliquam id illo omnis maxime, totam soluta voluptate amet ut sit ipsum aperiam. Perspiciatis, porro!


Does it improves the user experience of a website?

Lorem ipsum dolor, sit amet consectetur adipisicing elit. Velit saepe sequi, illum facere necessitatibus cum aliquam id illo omnis maxime, totam soluta voluptate amet ut sit ipsum aperiam. Perspiciatis, porro!

Step Two: Positioning our layouts and styling CSS Code: This section contains the positioning of our FAQ page, the font size, and the styling of the elements. Create layout columns, For our content to be readable, we must use a good font. Check out this link for the font used in the project google font. Center page in the middle of the window body{ font-family: 'Work Sans', sans-serif; } .faq-heading{ border-bottom: #777; padding: 20px 60px; } .faq-container{ display: flex; justify-content: center; flex-direction: column; } .hr-line{ width: 60%; margin: auto; } /* Style the buttons that are used to open and close the faq-page body */ .faq-page { /* background-color: #eee; */ color: #444; cursor: pointer; padding: 30px 20px; width: 60%; border: none; outline: none; transition: 0.4s; margin: auto; } .faq-body{ margin: auto; /* text-align: center; */ width: 50%; padding: auto; } /* Add a background color to the button if it is clicked on (add the .active class with JS), and when you move the mouse over it (hover) */ .active, .faq-page:hover { background-color: #F9F9F9; } /* Style the faq-page panel. Note: hidden by default */ .faq-body { padding: 0 18px; background-color: white; display: none; overflow: hidden; } .faq-page:after { content: '\02795'; /* Unicode character for "plus" sign (+) */ font-size: 13px; color: #777; float: right; margin-left: 5px; } .active:after { content: "\2796"; /* Unicode character for "minus" sign (-) */ } Step Three: Adding functionalities JavaScript Code: This section contains the part of the code that controls the functionalities of the FAQ page: the event handling. Now we are going to add javascript to make our FAQ page functional. Currently, our page looks beautiful but doesn’t work well because we haven’t included our javascript, but we can make it so much better. main.js file var faq = document.getElementsByClassName("faq-page"); var i; for (i = 0; i < faq.length; i++) { faq[i].addEventListener("click", function () { /* Toggle between adding and removing the "active" class, to highlight the button that controls the panel */ this.classList.toggle("active"); /* Toggle between hiding and showing the active panel */ var body = this.nextElementSibling; if (body.style.display === "block") { body.style.display = "none"; } else { body.style.display = "block"; } }); } Output Conclusion Having an FAQ page is essential and can serve as a better experience for your end-users that brings real value to your website. I hope this article has given you reasons for having an FAQ page on your website and how to build it. You can check out the code here on my Github page EZEKIEL LAWSON › I am a software developer with development experience in frontend building responsive website sites using these web technologies like Javascript, VueJs, HTML and CSS, Bootstrap Tailwind CSS. I specialize in converting designs to Code, and I love teaching and sharing my technical ideas through an article. Previous Article 5 Security Automation Examples for Non-Developers Next Article Build an Automation-First Security Culture DISCUSSION Click on a tab to select how you'd like to leave your comment MORE SWEETNESS… 2 months ago Build a CRUD SPA with Vuejs, Apollo Client and GraphQL 5 months ago Use Java Streams to Write Clean Java Code 9 months ago Java Versus Python: Key Programming Differences In 2021 SWEET VIDEOS body{ font-family: 'Work Sans', sans-serif; } .faq-heading{ border-bottom: #777; padding: 20px 60px; } .faq-container{ display: flex; justify-content: center; flex-direction: column; } .hr-line{ width: 60%; margin: auto; } /* Style the buttons that are used to open and close the faq-page body */ .faq-page { /* background-color: #eee; */ color: #444; cursor: pointer; padding: 30px 20px; width: 60%; border: none; outline: none; transition: 0.4s; margin: auto; } .faq-body{ margin: auto; /* text-align: center; */ width: 50%; padding: auto; } /* Add a background color to the button if it is clicked on (add the .active class with JS), and when you move the mouse over it (hover) */ .active, .faq-page:hover { background-color: #F9F9F9; } /* Style the faq-page panel. Note: hidden by default */ .faq-body { padding: 0 18px; background-color: white; display: none; overflow: hidden; } .faq-page:after { content: '\02795'; /* Unicode character for "plus" sign (+) */ font-size: 13px; color: #777; float: right; margin-left: 5px; } .active:after { content: "\2796"; /* Unicode character for "minus" sign (-) */ } Step Three: Adding functionalities JavaScript Code: This section contains the part of the code that controls the functionalities of the FAQ page: the event handling. Now we are going to add javascript to make our FAQ page functional. Currently, our page looks beautiful but doesn’t work well because we haven’t included our javascript, but we can make it so much better. main.js file var faq = document.getElementsByClassName("faq-page"); var i; for (i = 0; i < faq.length; i++) { faq[i].addEventListener("click", function () { /* Toggle between adding and removing the "active" class, to highlight the button that controls the panel */ this.classList.toggle("active"); /* Toggle between hiding and showing the active panel */ var body = this.nextElementSibling; if (body.style.display === "block") { body.style.display = "none"; } else { body.style.display = "block"; } }); } Output Conclusion Having an FAQ page is essential and can serve as a better experience for your end-users that brings real value to your website. I hope this article has given you reasons for having an FAQ page on your website and how to build it. You can check out the code here on my Github page EZEKIEL LAWSON › I am a software developer with development experience in frontend building responsive website sites using these web technologies like Javascript, VueJs, HTML and CSS, Bootstrap Tailwind CSS. I specialize in converting designs to Code, and I love teaching and sharing my technical ideas through an article. Previous Article 5 Security Automation Examples for Non-Developers Next Article Build an Automation-First Security Culture DISCUSSION Click on a tab to select how you'd like to leave your comment MORE SWEETNESS… 2 months ago Build a CRUD SPA with Vuejs, Apollo Client and GraphQL 5 months ago Use Java Streams to Write Clean Java Code 9 months ago Java Versus Python: Key Programming Differences In 2021 SWEET VIDEOS VISIT CHANNEL VISIT CHANNEL

Comments

Popular posts from this blog