Responsive Tabs

Developer
Size
3,473 Kb
Views
8,096

How do I make an responsive tabs?

What is a responsive tabs? How do you make a responsive tabs? This script and codes were developed by Daniel Grant on 28 December 2022, Wednesday.

Responsive Tabs Previews

Responsive Tabs - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Responsive Tabs</title> <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! */ @charset "UTF-8";
.module { border: 1px solid #ccc;
}
.tabs + .module { border-top: none;
}
.tabs { height: 30px; background: #eee; border: 1px solid #ccc; overflow: hidden;
}
.tabs::after { clear: both; content: ""; display: table;
}
.tabs ul { margin: 0; padding: 0;
}
.tabs li { list-style: none; float: left; border-right: 1px solid #ccc;
}
.tabs li.is-active { background: #fff;
}
.tabs a { display: block; line-height: 30px; padding: 0 10px;
}
.segment { padding: 20px;
}
@media (max-width: 769px) { .tabs { position: absolute; top: 0; left: 0; z-index: 1; } .tabs li { width: 100%; border-top: 1px solid #ccc; border-right: none; } .tabs li.is-active { position: absolute; top: 0; z-index: 1; border-top: none; } .tabs li.is-active a::after { content: "▼"; float: right; font-size: 12px; } .tabs.is-open { height: auto; overflow: visible; } .tabs.is-open ul { padding-top: 30px; }
}
* { position: relative; box-sizing: border-box;
}
iframe { max-width: 100%; border: none;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <div class="tabs"> <ul> <li><a href="#">Favourite Reports</a></li> <li class="is-active"><a href="#">General Reports</a></li> <li><a href="#">Income Reports</a></li> <li><a href="#">Expenditure Reports</a></li> <li><a href="#">Accounting Reports</a></li> <li><a href="#">Custom Reports</a></li> <li><a href="#">Advanced Reports</a></li> </ul>
</div>
<div class="module"> <div class="segment"> <iframe src="https://savedbythegoog.appspot.com/?id=2554790ee72c1b9dbb19f14e8f0e2619d38774c6" width=750 height=500></iframe> </div>
</div> <script src="js/index.js"></script>
</body>
</html>

Responsive Tabs - Script Codes CSS Codes

@charset "UTF-8";
.module { border: 1px solid #ccc;
}
.tabs + .module { border-top: none;
}
.tabs { height: 30px; background: #eee; border: 1px solid #ccc; overflow: hidden;
}
.tabs::after { clear: both; content: ""; display: table;
}
.tabs ul { margin: 0; padding: 0;
}
.tabs li { list-style: none; float: left; border-right: 1px solid #ccc;
}
.tabs li.is-active { background: #fff;
}
.tabs a { display: block; line-height: 30px; padding: 0 10px;
}
.segment { padding: 20px;
}
@media (max-width: 769px) { .tabs { position: absolute; top: 0; left: 0; z-index: 1; } .tabs li { width: 100%; border-top: 1px solid #ccc; border-right: none; } .tabs li.is-active { position: absolute; top: 0; z-index: 1; border-top: none; } .tabs li.is-active a::after { content: "▼"; float: right; font-size: 12px; } .tabs.is-open { height: auto; overflow: visible; } .tabs.is-open ul { padding-top: 30px; }
}
* { position: relative; box-sizing: border-box;
}
iframe { max-width: 100%; border: none;
}

Responsive Tabs - Script Codes JS Codes

var _each = function(a, b) { [].forEach.call(a, b);
}
var els = {};
els.tabs = document.querySelector('.tabs');
els.tabsLi = els.tabs.querySelectorAll('li');
var klasses = { active: 'is-active', open: 'is-open'
};
var selectors = { activeLi: 'li.is-active'
};
_each(els.tabsLi, function (li) { li.addEventListener('click', function () { els.tabs.classList.toggle(klasses.open); li.parentNode.querySelector(selectors.activeLi).classList.remove(klasses.active); li.classList.add(klasses.active); });
});
Responsive Tabs - Script Codes
Responsive Tabs - Script Codes
Home Page Home
Developer Daniel Grant
Username djgrant
Uploaded December 28, 2022
Rating 3
Size 3,473 Kb
Views 8,096
Do you need developer help for Responsive Tabs?

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!

Daniel Grant (djgrant) Script Codes
Create amazing blog posts 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!