How to Create Pure CSS Accordion

In this tutorial, I’ll create a CSS Accordion without using any jQuery or Javascript. As I mentioned in my previous post “An easy way to create Tabbed Content with jQuery & CSS” displaying a lot of information on one page is a bit difficult and we can use tabbed content or accordions to achieve the same without compromising on user experience.

We can always use jQuery to include nice effects on our css accordion. However, we are going to create a pure css accordion that will work on any browser, with or without javascript enabled.

Lets start with writing some HTML Code. We will use UL (unordered list) element to create our pure css accordion.

HTML Code for pure CSS Accordion:

<ul id="accordion">
  <li>
    <h2>Title One</h2>
    <div >
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
      tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
    </div>
  </li>
  <li>
    <h2>Title Two</h2>
    <div >
      Tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
      quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo.
    </div>
  </li>
  <li>
    <h2>Title Three</h2>
    <div >
      Quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
      consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse.
    </div>
  </li>
  <li>
    <h2>Title Four</h2>
    <div >
      Consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
      cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
      proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    </div>
  </li>
</ul>

As you can see, I have a UL element and added a class named “accordion”. Within the LI element, I have H2 and a DIV tag with class “content”. And we will play with the CSS display attribute to create our pure css accordion.

Lets write some CSS code to stylise the same and hide our DIV.content within the LI tags.

CSS Code for pure CSS Accordion:

#accordion{
    width: 600px;
    margin: 0px;
    padding: 0px;
    list-style: none;
}
#accordion h2{
    font-size: 12pt;
    margin: 0px;
    padding: 10px;
    background: #ccc;
    border-bottom: 1px solid #fff;
}
#accordion li div.content{
    display: none;
    padding: 10px;
    background: #f9f9f9;
    border: 1px solid #ddd;
}
#accordion li:hover div.content{
    display: inherit;
}

As you can see in above code, we have used display: none for the div.content and on li:hover we have used display:inherit . The div.content is within the list element so this trick would work. If our div.content would have been outside this panel, we would have used jQuery to achieve the same.

Very soon, I’ll explain to achieve the same with jQuery and will use some nice animation as well.

contact us

Best Website Designing Services

Does Website Redesign Services Make Any Difference in Business?

Are you wondering whether you should redesign the website? This is the right blog to go through. We recently had a massive Website Redesign Services on various platforms like Shopify, Magento, Laravel, that showed how much difference a website redesign can make. Unlike rebranding, which focuses on refreshing the image of your brand, redesigning the site is a completely new design that you are developing for the site to help you achieve your unique business goals. The goal of website design is to create a page that looks good, but you also want to design the page to deliver leads and sales to your business.

If you are dealing with a bad user experience, do not get the results you want, or need to change your brand marketing strategy, a redesign of the website is necessary. Think about redesign if you are not getting enough traffic or conversions.

Website Redesign Services is a complex undertaking that should only be considered if your current website has significant deficiencies. One of the first steps in deciding whether to redesign or update your website is to look at the design and content of your website. You can also go through the different types of website design, content, and user experience design to get a better understanding.

If you have any questions about web design, the team at IOGOOS Solution will assist you.

contact us

If you have an eCommerce store and you just need to clean up the content with a clear call-to-action and customize navigation to improve the user experience, you have website redesign services or Shopify Development Services. To ensure that you are fully aware of the steps you need to take to redesign your website, you need to think seriously about why you need or want to redesign your website. When you begin to evaluate the need for a website redesign or update, follow these five basic steps. Play with the design and content of your existing website and experiment with new features and features.

A redesign of the website can help to organize the information on your website more logically and improve the overall user experience for your visitors. Redesigning a website has features like becomes mobile-friendly, meet business goals easily. This includes responsive design, and if that is the case, redesigning the web pages can help ensure that everything flows seamlessly into one another and provides a consistent experience for your website users.

Introducing an evolutionary approach to redesigning websites and dramatically improving your website every day will protect against the risks of redesigning websites. With the redesign of the evolutionary website, you are often testing big and important changes and always aware of what is going on.

If you find something that needs updating, it may be time for your company to develop a new brand or web design. With a new brand, you might also feel that it’s time to launch a true-to-scale website that will be redesigned with a new logo, LOGO Design, and branding.

Investing in a redesign is an important option to consider, and you can work with a web design agency or decide how much you want to redesign. Overall, it depends on your ability to absorb the changes your business can choose to make to a website redesign or website redesign, but investing in the redesign itself is another important option to consider.

If your brand has changed significantly since your website was designed, it might be time to start redesigning the site. If your site is not able to meet new needs, such as additional pages, you may need to start planning for a website redesign. Content strategies are constantly changing, and in some cases, a website redesign is a perfect time to change the website platforms to your liking.

If your website lacks brand elements, it may be useful to redesign it when it has been updated, but rebranding as a business is not the same as redesigning a website. Decisions taken in this way to redesign the website will undoubtedly have an impact on the design and messages reflected on the website, and you must redesign your websites to reflect the significant changes in branding and ensure a consistent appearance. In some cases, websites can be redesigned to adapt to your brand’s improved communication, such as the new logo and logo design, and new content.

Get connect with IOGOOS for complete Website Solutions, WordPress Development Services, SEO, Online Promotion, Local SEO.

Also Read:
How to Increase organic traffic for better ranking AND Lead Generation Tactics

Enquiry Now

When We Work Together

We can create something incredible

arrow
HQ INDIA
HQ INDIA
C-31, Milap Nagar,
Uttam Nagar, New Delhi,
Delhi 110059
USA
USA
6715 Backlick Rd Suite 202
Springfield,
VA 22150, USA
AUSTRALIA
AUSTRALIA
2/51, Lane Cres,
Reservoir, VIC
3037, Australia
CANADA
CANADA
61 Payzant Bog Road, Falmouth, NS, B0P 1P0, CANADA
UK
UK
3rd Floor, 131 City Road, London, EC1V 2NX, United Kingdom
UAE
UAE
Boutik Mall, Al Reem Island - Abu Dhabi, UAE
X

Let Us Call You Back

  • India+91
  • United States+1
  • United Arab Emirates+971

Your phone number is kept confidential
and not shared with others.