Skip to content

Instantly share code, notes, and snippets.

@kpunith8
Last active July 2, 2021 05:52
Show Gist options
  • Save kpunith8/e36134ed571f16167014792565266680 to your computer and use it in GitHub Desktop.
Save kpunith8/e36134ed571f16167014792565266680 to your computer and use it in GitHub Desktop.
CSS Tips
/* Padding to the hover effect without adding padding to the original element */
':hover': {
background: gray,
cursor: 'pointer',
width: 240px, /* Can be dynamic */
padding: '0 10px',
margin-left: -10px,
},
<html>
<style>
html {
scroll-behavior: smooth;
}
</style>
<body>
<!-- Anchor tag in the nav-bar -->
<a href="#about">About<a/>
<!-- Section further down the page -->
<section id="about"></section>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment