This unique pen sports a few custom underline effects created with pure CSS by developer Matthew Scott. This considers letterforms like ‘g’ and ‘p’ where lines drop beneath the usual line height.Īlso the underline itself is pushed ever-so-slightly lower beneath the text so it takes on a new appearance compared to the browser default. In Lukas Horak’s better text underline you’ll notice the bar underneath the text fits nicer into descending elements. But if you compare it to the “default” demo lower in the page you’ll see this really does look a lot better. Better Text UnderlineĪt first glance you may not notice anything different with this underline.
#Css3 menu hover animation code
Plus all of the results can be altered in the CSS code which includes easings and total duration. You can design your navigation menus just like any other site and use this CSS effect to create dynamic sliding animations. It’s a pretty elegant solution considering it doesn’t even require an extra HTML item. Sliding Underlineĭeveloper Ryan Morse created this very simple sliding underline effect reliant solely on CSS. Plus this whole thing uses a custom CSS3 gradient for the background which is pretty darn cool. But it’s also dynamic enough to work with any link on the page, so it doesn’t matter how you format the text. Note this does rely on a bit of JavaScript to keep the line in-tact. But with some ingenuity developer Will King built this pen creating a dynamic underline effect that can span multiple lines without any bugs. Spanning Multiple LinesĬSS line break styles are tricky and not easy to work around. Surprisingly simple considering how little code you need (about 60 lines of CSS). You can do all of this yourself with a bit of CSS by adding the underlined block into an HTML element. Not only that, but it moves across the nav dynamically to give the illusion that it’s one singular block. The underline effect in the nav menu actually changes styles between links. If you move your cursor between these links you’ll notice something kinda funny. For the hover state we will only change the text color.įont-family: Helvetica, Arial, sans-serif To create the links separator add a border to the left and right and then we will remove the left border from the first link and the right border from the last link. Then we will add a dark text shadow and a color transition to create a smooth effect when the color changes on hover state. To style the menu links we will add some basic CSS properties like font, color, padding, etc. With Postcards you can create and edit email templates online without any coding skills! Includes more than 100 components to help you create custom emails templates faster than ever before. We will hide the sub menu temporarily to be easier to style the first level. We also need to set the position to relative because we will need that to align the sub menus.īackground: -webkit-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%) īackground: -moz-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%) īackground: -o-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%) īackground: -ms-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%) īackground: linear-gradient(top, #4c4e5a 0%,#2c2d33 100%) To align the links horizontally we will float the lists to left. Then we will add a fixed width and height to the menu, rounded corners and the CSS3 gradients. We will start to remove the margin, padding, border and outline from all the elements of the menu. To create the sub menu add another unordered list inside of the list. We will create an unordered list with a list item and an anchor tag for each menu link. Download Dropdown Menu Step 1 – HTML Markup