Responsive Square with Background Image
How do I make an responsive square with background image?
A responsive square with a background image - the only thing is that because the image is a background, you can't add alt text.. What is a responsive square with background image? How do you make a responsive square with background image? This script and codes were developed by Anya Craig on 26 August 2022, Friday.
Responsive Square with Background Image - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Responsive Square with Background Image</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="container"> <img src="https://s-media-cache-ak0.pinimg.com/736x/b3/32/b1/b332b1221cc8ff848aa91982743576f4.jpg" alt="a baby duckling sitting on its duckling butt">
</div>
<!-- Of course, you could just set the image as the background of the div, but then a screenreader wouldn't have any alt text to read -->
</body>
</html>
Responsive Square with Background Image - Script Codes CSS Codes
.container { width: 50%; padding-bottom: 50%; margin: 10% auto; position: relative; overflow: hidden;
}
.container img { position: absolute; height: 100%;
}
Developer | Anya Craig |
Username | AnyaCraig |
Uploaded | August 26, 2022 |
Rating | 3 |
Size | 1,712 Kb |
Views | 48,576 |
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!
Name | Size |
Cupid in Pursuit | 4,193 Kb |
Bee flight animation using Snap.svg | 4,355 Kb |
Flex Baseline Test | 1,603 Kb |
Leaf animation with Snap.svg on scroll-by | 2,543 Kb |
Fancy Two-Border Buttons | 1,651 Kb |
Hover zoom on a background image | 1,957 Kb |
Simple Responsive Gallery | 1,595 Kb |
Fair to Foul | 3,716 Kb |
Responsive Image Height Test | 1,686 Kb |
Pawprints animation | 6,928 Kb |
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!
Name | Username | Size |
Vue.js Starter | Andymerskin | 1,268 Kb |
Sketchy Box | Mnicpt | 3,033 Kb |
SVG Playground | Roygwells | 1,834 Kb |
Bootstrap 4 Gridsystem Demo | Rivella50 | 1,535 Kb |
Simple Weather App | Cmwebby | 0 Kb |
Simple DevTools | Deegill | 2,511 Kb |
Tic Tac Toe | Volv | 4,862 Kb |
Scroll using CSS | Casperovic | 2,159 Kb |
Default Input, Textareas, Submits, and Buttons in iOS | Demersdesigns | 2,334 Kb |
Pagepilling.js | Blossk | 6,554 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!