Basic split button with dropdown

Developer
Size
2,237 Kb
Views
8,096

How do I make an basic split button with dropdown?

This is a basic, flat split button with a dropdown menu. I couldn't find a good, basic split button tutorial, so I built one here.. What is a basic split button with dropdown? How do you make a basic split button with dropdown? This script and codes were developed by Laura Kelly on 29 January 2023, Sunday.

Basic split button with dropdown Previews

Basic split button with dropdown - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>basic split button with dropdown</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <html> <body> <a class="button"> <div class="buttonContents"> <p>Split Button</p> <div id="split"> <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> <polygon points="0,1 10,1 5,10" /> </svg> </div> <div class="dropdown"> <ul> <li>Thing 1</li> <li>Thing 2</li> <li>Thing 3</li> </ul> </div> </a> </body>
</html> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Basic split button with dropdown - Script Codes CSS Codes

body { font-family: helvetica; color: #333333;
}
.buttonContents { height: 30px; width: 140px; font-family: helvetica; font-weight:bold; border: solid 1px grey; /* round corners */ -webkit-border-radius: 3px; -moz-border-radius: 3px; -ms-border-radius: 3px; -o-border-radius: 3px; border-radius: 3px;
}
.buttonContents:hover { border: solid 1px #222222;
}
.button:hover { cursor: pointer;
}
p { margin: 6.5px 0px 0px 0px; padding: 0px 7px 0px 7px; display: inline-block;
}
#split { height: 30px; width: 30px; float: right; background-color: grey; margin: 0px 0px 0px 0px;
}
#split:hover { background-color: #333333;
}
svg { height: 10px; width: 10px; margin: 10px 0px 0px 10px;
}
polygon { fill: #ffffff;
}
.dropdown { display: none; border: solid 1px grey; background-color: lavender; color: #4D4D4D; margin: 7px 0px 0px 110px; padding: 5px 5px 5px 5px; font-size: 0.8em; position: absolute; /* round corners */ -webkit-border-radius: 3px; -moz-border-radius: 3px; -ms-border-radius: 3px; -o-border-radius: 3px; border-radius: 3px;
}
ul { list-style: none; margin: 0px 20px 0px 0px; padding: 0px 0px 0px 0px;
}
li:hover { color: black;
}

Basic split button with dropdown - Script Codes JS Codes

$(".button").click(function() { $(".dropdown").toggle();
});
$(".button").mouseleave(function() { $(".dropdown").hide();
});
Basic split button with dropdown - Script Codes
Basic split button with dropdown - Script Codes
Home Page Home
Developer Laura Kelly
Username laurakelly
Uploaded January 29, 2023
Rating 3
Size 2,237 Kb
Views 8,096
Do you need developer help for Basic split button with dropdown?

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!

Laura Kelly (laurakelly) Script Codes
Create amazing SEO content 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!