Select
How do I make an select?
Part of my Responsive Menu Concepts article on CSS-Tricks.. What is a select? How do you make a select? This script and codes were developed by Tim Pietrusky on 20 June 2022, Monday.
Select - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Select</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! */ @import url(http://fonts.googleapis.com/css?family=Exo:400,500,700,700italic);
* { box-sizing: border-box;
}
html,
body { width: 100%; height: 100%;
}
body { margin: 1.25em .75em; background: url(http://subtlepatterns.com/patterns/black-Linen.png); font: 1.4em 'Exo', sans-serif;
}
nav[role="select"] { width: 100%; position: relative; color: #000;
}
nav[role="select"] > select { display: none;
}
nav[role="select"] ul { width: 100%; list-style: none;
}
nav[role="select"] ul > li { float: left; padding: .55em .45em; width: 19%; font-size: 1.2em; background-color: rgba(174, 86, 168, 0.5); text-align: center; transition-duration: .15s; transition-timing-function: ease-in-out; transition-property: box-shadow, background, color, text-align, padding; cursor: pointer;
}
nav[role="select"] ul > li:hover { background-color: rgba(174, 86, 168, 0.3); color: #fff; text-align: left; padding-left: .75em; box-shadow: 0 0 0 0.25em rgba(0, 0, 0, 0.3), 0 0 0 0.5em rgba(0, 0, 0, 0.3), 0 0 0 0.75em rgba(0, 0, 0, 0.3), inset 0 0 0 0.25em rgba(0, 0, 0, 0.3);
}
nav[role="select"] ul > li > a { color: inherit; text-decoration: none; transition: inherit;
}
/* small screens */
@media screen and (max-width: 44em) { body { margin: 1em 0; } nav[role="select"] ul { display: none; } nav[role="select"]:after { position: absolute; z-index: -1; content: "Menu"; right: 0; bottom: -1.75em; background: rgba(174, 86, 168, 0.4); padding: .15em .55em; } nav[role="select"] select { display: block; user-select: none; cursor: pointer; width: 100%; padding: .55em .45em; border: none; background-color: rgba(174, 86, 168, 0.25); font: 1.2em 'Exo', sans-serif; }
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <nav role="select"> <ul> <li><a href="#">Stream</a></li> <li><a href="#">Lab</a></li> <li><a href="#">Projects</a></li> <li><a href="#">About</a></li> <li><a href="#">Contact</a></li> </ul> <select onchange="if (this.value) window.location.href = this.value;"> <option value="#">Stream</option> <option value="#">Lab</option> <option value="#">Projects</option> <option value="#">About</option> <option value="#">Contact</option> </select>
</nav> <script src="js/index.js"></script>
</body>
</html>
Select - Script Codes CSS Codes
@import url(http://fonts.googleapis.com/css?family=Exo:400,500,700,700italic);
* { box-sizing: border-box;
}
html,
body { width: 100%; height: 100%;
}
body { margin: 1.25em .75em; background: url(http://subtlepatterns.com/patterns/black-Linen.png); font: 1.4em 'Exo', sans-serif;
}
nav[role="select"] { width: 100%; position: relative; color: #000;
}
nav[role="select"] > select { display: none;
}
nav[role="select"] ul { width: 100%; list-style: none;
}
nav[role="select"] ul > li { float: left; padding: .55em .45em; width: 19%; font-size: 1.2em; background-color: rgba(174, 86, 168, 0.5); text-align: center; transition-duration: .15s; transition-timing-function: ease-in-out; transition-property: box-shadow, background, color, text-align, padding; cursor: pointer;
}
nav[role="select"] ul > li:hover { background-color: rgba(174, 86, 168, 0.3); color: #fff; text-align: left; padding-left: .75em; box-shadow: 0 0 0 0.25em rgba(0, 0, 0, 0.3), 0 0 0 0.5em rgba(0, 0, 0, 0.3), 0 0 0 0.75em rgba(0, 0, 0, 0.3), inset 0 0 0 0.25em rgba(0, 0, 0, 0.3);
}
nav[role="select"] ul > li > a { color: inherit; text-decoration: none; transition: inherit;
}
/* small screens */
@media screen and (max-width: 44em) { body { margin: 1em 0; } nav[role="select"] ul { display: none; } nav[role="select"]:after { position: absolute; z-index: -1; content: "Menu"; right: 0; bottom: -1.75em; background: rgba(174, 86, 168, 0.4); padding: .15em .55em; } nav[role="select"] select { display: block; user-select: none; cursor: pointer; width: 100%; padding: .55em .45em; border: none; background-color: rgba(174, 86, 168, 0.25); font: 1.2em 'Exo', sans-serif; }
}
Select - Script Codes JS Codes
/** Select # What? # Part of my "Responsive Menu Concepts" article on CSS-Tricks http://css-tricks.com/responsive-menu-concepts # 2012 by Tim Pietrusky # timpietrusky.com
**/
Developer | Tim Pietrusky |
Username | TimPietrusky |
Uploaded | June 20, 2022 |
Rating | 4 |
Size | 4,112 Kb |
Views | 56,672 |
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!
Name | Size |
Bullshit Job Title Generator | 7,583 Kb |
Off Canvas | 7,693 Kb |
Kudos Please | 6,624 Kb |
Webs Pricing Table | 7,716 Kb |
Monster Energy SVG logo animated | 7,705 Kb |
Asdf | 16,941 Kb |
Liquid Loading | 3,135 Kb |
Advanced Checkbox Hack | 3,416 Kb |
Blurry Sweetness | 4,034 Kb |
FlatUI Checkout concept | 6,972 Kb |
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!
Name | Username | Size |
A Pen by Moeid Saleem | Moeidsaleem | 1,862 Kb |
CSS Variables | Jdsteinbach | 4,759 Kb |
HTML5 Video Autoplay | Zivcos | 1,352 Kb |
Brian The CSS Bee | Jonitrythall | 3,922 Kb |
Toggling Divs with jQuery | Yying6 | 1,967 Kb |
Myprofile | SoufianeAbid | 2,451 Kb |
CSS Social Media Icon | TychoBlender | 3,871 Kb |
BSP Dungeon Generation | Xgundam05 | 5,326 Kb |
Background Images | Jooonebug | 2,100 Kb |
Importable Clearfix | Corysimmons | 1,411 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!