Golang Tutorials - Learn Go Programming with Easy Step-by-Step Guides

Explore comprehensive Golang tutorials for beginners and advanced programmers. Learn Go programming with easy-to-follow, step-by-step guides, examples, and practical tips to master Go language quickly.

Image Styling in CSS

Image Styling in CSS

? Image Styling in CSS

CSS gives you many ways to style images to improve the look and fit them perfectly into your design.


Common CSS Properties for Images

PropertyDescriptionExample
width / heightResize the imagewidth: 200px; height: auto;
border-radiusRound corners or make circleborder-radius: 50%;
box-shadowAdd shadow around the imagebox-shadow: 0 4px 8px rgba(0,0,0,0.3);
object-fitControl how image fits its containerobject-fit: cover;
filterApply effects like blur, grayscale, etc.filter: grayscale(100%);
opacityMake image transparentopacity: 0.8;
borderAdd bordersborder: 2px solid #333;
transformRotate, scale, skew, etc.transform: rotate(10deg);
cursorChange cursor on hovercursor: pointer;
transitionSmooth animations on hover or changetransition: transform 0.3s ease;

Example: Stylish Profile Picture

<img src="profile.jpg" alt="Profile" class="profile-pic">
.profile-pic {  width: 150px;  height: 150px;  border-radius: 50%;  object-fit: cover;  border: 3px solid #3498db;  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);  transition: transform 0.3s ease;}.profile-pic:hover {  transform: scale(1.1);  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);  cursor: pointer;}

Tips

  • Use object-fit: cover to maintain aspect ratio while filling the container.

  • Combine border-radius and box-shadow for nice rounded images with depth.

  • Use filter to apply artistic effects.

  • Add transition to animate style changes smoothly on hover or focus.


Want a custom image styling example or help with effects like hover zoom, grayscale toggle, or frame?

Disclaimer for AI-Generated Content:
The content provided in these tutorials is generated using artificial intelligence and is intended for educational purposes only.
html
docker
php
kubernetes
golang
mysql
postgresql
mariaDB
sql