Water Glass Using HTML, CSS | Water Effect | #untoldcoding

 Water Glass Using HTML, CSS | Water Effect | #untoldcoding

Ever dreamed of drawing sparkling watermarks on your website without resorting to complicated JavaScript? Well, buckle up, web wizards, because we’re about to draw a refreshing glass of water using only HTML and CSS!


This is not your average flat model. We’ll add microwaves and reflections, creating dynamic water features that dance in front of your guests’ eyes. Ready to unleash your inner artist? Let’s get started!




Step 1 Html Code :




This is a document type declaration that specifies which HTML version to use. In this case, it’s HTML5.
The opening <html> tag displays the beginning of the HTML document. the lang attribute indicates the language of the document, which in this case is set to English.
The <head> section contains metadata about the document. The <meta> tag with the charset attribute sets the character encoding to UTF-8, which is the most widely used character encoding for text on the web.
Another <meta> tag is used to describe the viewport. This ensures that the width of the viewport is set to the width of the device, and that the initial zoom level is set to 1.0.
The <link> tag is used to link an external style document to an HTML document. the rel attribute indicates the relationship, and the href indicates the location of the stylesheet. In this case, the stylesheet is named "style.css".
The <body> tag contains the content of the HTML document. In this example, it is a <div> element with the function attribute set to "img" and the aria-label attribute set to "water glass". This means that the <div> is intended to represent an image with a color label. But the actual content (such as images or text) is not provided in a given piece of code and would normally be encapsulated in a <div> for display on a web page

Now, let’s use CSS borders to define the shape of the mirror:

Step 2 CSS Code:





position: absolute;: div Position an element absolutely.Width: 22em; height: 40em;: Set the width and height of the div to create the size of the mirror.
The upper range: 50%; left: 50%;: Move the center of the div up and down by the upper left corner.
transform: translate(-50%, -50%);: change the position to exactly center the div.
The background mode consists of a series of linear and radial gradients that create a glassy look with water and reflections. The frames are carefully placed and shaped to achieve the desired effect.

These pseudo elements (div:after and div:before) are used to enhance the appearance of the mirror and create other visual effects, such as highlights and reflections Background properties have different linear and radial gradients for this purpose.

Join us on Telegram : Click here.

Join with us YouTube : Click here.

Join with us Instagram: Click here.



Final Thoughts
By combining HTML and CSS you can create visually stunning looks like this waterfall. Experiment with code, tweak gradients, and add them to your projects. This is a great way to add some creativity and realism to your web design. Happy coding!

FAQ: Creating a Water Glass Effect with HTML and CSS


Q1: What does a given HTML framework represent?
A: HTML layout and basic document layout. The <div> element of the <body> tag represents the water glass container in our visual perspective.

Q2: How do the CSS rules contribute to the water crystal effect?
A: The CSS code applies styles to both body and div element. Different mounts, shapes and positions are used to create the impression of a water-filled glass. Pseudo-elements add additional visual effects such as :after and :befo reflections and highlights.

Q3: What is the purpose of overflow: hidden; The legacy of prosthetics?
A: Overflow: hidden; The property prevents any overflow from being visible, ensuring that the water crystal effect remains within the specified dimensions.

Question 4: How does a media query (@media (max-width: 599px)) affect styling?
A: The media query changes the styling for screens that are 599 pixels wide or smaller. It is used to standardize the design, ensuring that the water crystal effect looks good on smaller devices.

No comments

Powered by Blogger.