In CSS, visual effects are used to give components inventive style (blend modes) or depth (shadows).
Box-Shadow: Enhances the shadow surrounding the frame of an element.
Text-Shadow: This adds shadow to text to improve legibility or provide a text effect with style.
Blend Modes: Regulates how the content of an element should mix in with the backdrop.
Code
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Visual Effects Example</title> <style> .box-shadow { width: 200px; height: 100px; background-color: salmon; box-shadow: 10px 10px 20px grey; margin-bottom: 20px; } .text-shadow { font-size: 24px; text-shadow: 4px 4px 4px rgba(0,0,0,0.4); } .blend-mode { width: 200px; height: 100px; background-color: red; background-blend-mode: multiply; background-image: url('https://via.placeholder.com/200x100'); color: white; text-align: center; padding-top: 30px; } </style> </head> <body> <div class="box-shadow">Box Shadow</div> <div class="text-shadow">Text Shadow</div> <div class="blend-mode">Blend Mode</div> </body> </html> |
Box-Shadow: Casts a gray shadow with a 20-pixel blur radius that is 10 pixels to the right and 10 pixels to the bottom of the element.
Text-Shadow: This adds a blurred shadow to the text that is offset by 4 pixels in both the horizontal and vertical directions.
Blend Mode: With the background-blend-mode attribute set to multiply, a distinctive visual effect is produced by mixing the red background color with the placeholder picture.
In CSS, visual effects are used to give components inventive style (blend modes) or depth (shadows).
Box-Shadow: Enhances the shadow surrounding the frame of an element.
Text-Shadow: This adds shadow to text to improve legibility or provide a text effect with style.
Blend Modes: Regulates how the content of an element should mix in with the backdrop.
Code
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Visual Effects Example</title> <style> .box-shadow { width: 200px; height: 100px; background-color: salmon; box-shadow: 10px 10px 20px grey; margin-bottom: 20px; } .text-shadow { font-size: 24px; text-shadow: 4px 4px 4px rgba(0,0,0,0.4); } .blend-mode { width: 200px; height: 100px; background-color: red; background-blend-mode: multiply; background-image: url('https://via.placeholder.com/200x100'); color: white; text-align: center; padding-top: 30px; } </style> </head> <body> <div class="box-shadow">Box Shadow</div> <div class="text-shadow">Text Shadow</div> <div class="blend-mode">Blend Mode</div> </body> </html> |
Box-Shadow: Casts a gray shadow with a 20-pixel blur radius that is 10 pixels to the right and 10 pixels to the bottom of the element.
Text-Shadow: This adds a blurred shadow to the text that is offset by 4 pixels in both the horizontal and vertical directions.
Blend Mode: With the background-blend-mode attribute set to multiply, a distinctive visual effect is produced by mixing the red background color with the placeholder picture.
Copyrights © 2024 letsupdateskills All rights reserved