Skip to content Skip to left sidebar Skip to footer

Localising SDG

Document

No JS: Tabs That Scale Down to Menu

Localising SDG

About Us

Dr. Jayanta Choudhury has wide experience in teaching and research in Rural Development for the last 22 yrs. Passionate, relentless, dedicated and true with his vision firmly focused on the horizon of Localising Sustainable Development Goal. Dr. Choudhury presently working as Assistant Professor, Department of Rural Studies, Tripura University, India. He was Associate Professor (on Deputation), National Institute of Rural Development &Panchayati Raj, North East Regional Centre, Ministry of Rural Development, Government of India for three years. He is the author of 25 books and more than 55 research articles published in National and International journals and in edited volumes. Six Ph.D. Scholars awared under his supervision. He has led/worked with different research projects in India and Bangladesh funded by World Bank, ILO, UNICEF, IGDC, GTZ, MoTA, MoRD, etc. He is also the Founder of the North East Training, Research and Advocacy (NETRA) Foundation and the Global Forum for Sustainable Rural Development (GFSRD) – an orgnisation having 6 continetal offices and 129 country chapters. . He is recognized as Expert, Inclusive Policy Lab, UNESCO. He is an active member of various Civil Society Organisations (CSOs) like IFRTD, London; Global Forum for Rural Advisory Services (GFRAS), Switzerland; Community of Evaluators, SriLanka. He is also a board member of Forum for India Development Cooperation (FIDC), Research and Information System for Developing Countries, New Delhi; Financial Inclusion Trust (2009-2019), North Eastern Financial Inclusion Trust (2019 onward) (under the aegis of Bandhan Bank, India), Bandhan Financial Holding Company, West Bengal. Global Peace Let’s Talk, London, etc. He did his Ph.D. and Masters in Rural Development from Visva-Bharati University, West Bengal. He teaches Inclusive Rural development; Rural Development Planning & Project Management; Financial Inclusion; Social Enterprises to PG students. He serves as Associate Editor for International Journal of Rural Development & Management Studies (IJRDMS) and TUI – A journal on Tribal Life and Culture. He has led various internationally funded development projects in India and Bangladesh. Received Global Award (Best Professor in Rural Development) from World Education Congress-2015 and Broad Outlook Learner Teacher (BOLT) Award-2006 from AIR INDIA, Mumbai.

Input :checked

In CSS, you can query based on the :checked selector for radios and checkboxes to style siblings down the DOM scope. To do this, we can use the ~. It will select same-level siblings after the given selector. Because the tab labels in this demo are nested and not immediate siblings, we will need to select their topmost parent that is at the same level as our input.

To demonstrate, we will do a simplified version of this with a checkbox:

<!-- invisible input and its label -->
<input id="demo-child-toggle" type="checkbox">
<label for="demo-child-toggle">Toggle #demo-child</label>

<-- parent to select first via "~" -->
<div id="demo-parent">
<-- child to select through parent -->
<div id="demo-child">#demo-child</div>
</div>

and in our CSS:

/* hiding our checkbox */
#demo-child-toggle {
display: none;  
}
/* selecting the child */
#demo-child-toggle:checked ~ #demo-parent #demo-child {
color: #c0392b;
font-weight: bold;
text-transform: uppercase;
}

#demo-child

As you can see, we can control the style of content that comes after a hidden input by toggling it via its label.

At this point you can probably get the picture for how we can conditionally display the tabbed panel content in this pen.

The Tabs

Here is the basic form of a tab in this demo:

<li id="li-for-panel-1">
<label class="panel-label" for="panel-1-ctrl">CSS Radio Toggles</label>
</li>

For the “active” tab to cover the bottom border, the child label gets an additional 2 pixels of padding-top while its parent li gets a translateY(1px). This not only covers the bottom border, but gives an ever-so-subtle “moving toward you” effect by shifting the title down 1px.

#panel-1-ctrl:checked ~ #tabs-list #li-for-panel-1 {
transform: translate3d(0, 1px, 0);
}
#panel-1-ctrl:checked ~ #tabs-list #li-for-panel-1 label.panel-label {
padding-top: 26px; /* instead of "24px" */
}
Global Conference on Localising Sustainable Development Goals(SDGs-1)
January 16-17, 2021
Global Conference on Localising Sustainable Development Goals(SDGs-2)
December 12-13, 2020
Global Conference on Localising Sustainable Development Goals(SDGs-3)
Feb 20, 2021
GLOBAL CONFERENCE ON LOCALISING SUSTAINABLE DEVELOPMENT GOALS (SDGs-4)
April 17, 2021
Global Conference on Localising Sustainable Development Goals(SDGs-5(i))
January 28-29, 2023
Global Conference on Localising Sustainable Development Goals(SDGs-5(ii))
JUNE 26, 2021

Our Partners

On small screens, the tabs fold down into an expandable menu. To trigger the menu, I use a checkbox (note that it appears at the top of the screen on smaller screen sizes). There are two labels that trigger this checkbox. One opens and the other closes the menu. The one that opens is absolutely positioned invisibly over the “active” menu item. The closing label is at the bottom of the open menu.

The best way I have found to show and hide content without using absolute positioning is to use a combination of max-height and opacity. When “inactive”, the content has a max-height: 0 and opacity: 0.

It also has a transition: opacity when I don’t know the future height (this panel’s content for example) and transition: opacity, max-height when I do know the future height (like the menu). When “active”, the max-height and opacity get positive values and the content will transition in. I’m sure flexbox could get me around this hack, but this works for now.