CSS Dynamic Width Square Div

Developer
Size
2,861 Kb
Views
44,528

How do I make an css dynamic width square div?

This shows the use of a transparent 1x1 gif to simulate a square div with dynamic width.This doesn't use any JS. (Yay!). What is a css dynamic width square div? How do you make a css dynamic width square div? This script and codes were developed by Elleestcrimi on 11 August 2022, Thursday.

CSS Dynamic Width Square Div Previews

CSS Dynamic Width Square Div - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>CSS Dynamic Width Square Div</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ .square-hack { width: 100%; visibility: hidden;
}
.square { background: #1d7cc1; border: 20px solid #156AA8; margin: 100px auto; animation: dynamicWidth 5s linear 0s infinite alternate; position: absolute; top: 0; left: 0; right: 0; bottom: 0; margin: auto; display: table;
}
@keyframes dynamicWidth { from { width: 0%; } to { width: 50%; }
}
html { background: #e0e0e0;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <div class='square'> <img class='square-hack' src='data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

CSS Dynamic Width Square Div - Script Codes CSS Codes

.square-hack { width: 100%; visibility: hidden;
}
.square { background: #1d7cc1; border: 20px solid #156AA8; margin: 100px auto; animation: dynamicWidth 5s linear 0s infinite alternate; position: absolute; top: 0; left: 0; right: 0; bottom: 0; margin: auto; display: table;
}
@keyframes dynamicWidth { from { width: 0%; } to { width: 50%; }
}
html { background: #e0e0e0;
}

CSS Dynamic Width Square Div - Script Codes JS Codes

// Credit to the smallest gif EVER! Goes to http://probablyprogramming.com/2009/03/15/the-tiniest-gif-ever
// Gif url http://probablyprogramming.com/2009/03/15/the-tiniest-gif-ever
CSS Dynamic Width Square Div - Script Codes
CSS Dynamic Width Square Div - Script Codes
Home Page Home
Developer Elleestcrimi
Username elleestcrimi
Uploaded August 11, 2022
Rating 3
Size 2,861 Kb
Views 44,528
Do you need developer help for CSS Dynamic Width Square Div?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Elleestcrimi (elleestcrimi) Script Codes
Create amazing marketing copy with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!