How to Create Directionally Lit 3D Buttons using CSS ? Last Updated : 18 Nov, 2024 Comments Improve Suggest changes Like Article Like Report To create 3D buttons with directional lighting effects using CSS, we'll combine transformations, shadows, and pseudo-elements to simulate depth and light. These buttons will include Font Awesome icons and respond interactively to user actions. Here's how you can achieve this effect.Start with a basic HTML structure that includes a list of buttons HTML <!-- index.html --> <html> <head> <link rel="stylesheet" href="styles.css" type="text/css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> </head> <body> <div> <ul> <li id="like"> <a href="#"> <i class="fa fa-thumbs-up"></i> Like </a> </li> <li id="comment"> <a href="#"> <i class="fa fa-comment"></i> Comment </a> </li> <li id="share"> <a href="#"> <i class="fa fa-share"></i> Share </a> </li> </ul> </div> </body> </html> A list of buttons (Like, Comment, Share) is created using an unordered list <ul>.Each button has a Font Awesome icon and is styled within an <a> element.Now apply styles to create the 3D effect, including transformations and shadows CSS /* styles.css */ * { margin: 0; padding: 0; } div { background: lightgreen; width: 100vw; height: 100vh; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; position: relative; display: flex; align-items: center; justify-content: center; } ul { position: absolute; display: flex; margin: 0; padding: 0; } a { text-decoration: none; color: rgba(0, 0, 0, 0.7); } i { padding: 10px; } ul li { list-style: none; margin: 10px; display: block; } ul li a { width: 200px; height: 50px; background: orangered; display: flex; font-size: 20px; align-items: center; justify-content: center; transform: rotate(-30deg) skewX(25deg); box-shadow: -20px 20px 8px rgba(0, 0, 0, 0.5); } ul li a:before { content: ''; position: absolute; top: 10px; left: -20px; background: orangered; height: 100%; width: 20px; transform: rotate(0deg) skewY(-45deg); } ul li a:after { content: ''; position: absolute; bottom: -20px; left: -10px; background: orangered; height: 20px; width: 100%; transform: rotate(0deg) skewX(-45deg); } li a:hover { transform: rotate(-30deg) skew(25deg) translate(20px, -15px); } The buttons (ul li a) are transformed using rotate and skew to create a 3D effect.Shadows are added using box-shadow to simulate depth and light direction.The :before and :after pseudo-elements create "sides" for the button to enhance the 3D appearance.On hover, the button moves slightly to simulate pressing using transform.Output3D lit buttons Comment More infoAdvertise with us Next Article How to Create Directionally Lit 3D Buttons using CSS ? S sabarish0088 Follow Improve Article Tags : Web Technologies CSS CSS-Questions Similar Reads How to create fading buttons using CSS ? This article will explore how to create fading buttons using CSS. We can create two types of fading effects in buttons including fadeIn and FadeOut. The CSS property opacity is used to give a fading effect on hovering the button. Fading buttons offer an effective way to provide a pleasing visual eff 3 min read How to create Text Buttons using CSS ? In this article, we are going to see how to create text buttons using CSS. The text button is a button that appears to be text but acts as a button if we press it. Text buttons are different from anchor tags even if they might look similar. To create text buttons first, we create simple buttons in H 2 min read How to create gradient search button using HTML and CSS ? In this article, we will see how to create a gradient search button using HTML & CSS, along with knowing its basic implementation through the examples. The creation of a gradient search button involves the CSS linear-gradient() function, which sets the background color of the button. Here, we ha 4 min read Create Buttons UI using React and Tailwind CSS Tailwind CSS is a utility-first CSS framework that allows developers to quickly build responsive and reusable components. We'll explore how to create buttons with different styles such as primary, secondary, and disabled states, and buttons of various sizes.PrerequisitesReact JavaScriptNodeJSTailwin 2 min read How to create Animated Hovered 3-D Buttons Effect using CSS ? The hovered 3-D effect on a button is an effect in which the button appears to come toward the user on hovering. These buttons are created using HTML and CSS.Approach: The best way to animate the HTML objects is done by using CSS @keyframes and by setting the transitions at different stages.Example: 3 min read Like