CSS for disabled input field

If you only want to style the input fields of type=”text”:


input[type="text"]:disabled {
  background: #eee;
}

And if you want to style all the input fields.


input:disabled {
  background: #eee;
}

Smooth Scrolling in CSS3

Hello friends.
I have noticed that many people are using Smooth Scroll behavior these days on the websites, which is a good thing. And it looks good too. But many people use JavaScript or jQuery to do this. This is right. But it can also be done in an easier way.

Now you must be thinking which is the easiest way I am talking about. I am talking about CSS3, you can also find behavior like Smooth Scrolling through CSS3.

You just need to apply the below rule on your web page.


html {
  scroll-behavior: smooth;
}

Up and Down animation – CSS3

As you people would know that it is now possible to make animation from CSS3 as well. And we can make some easy and simple animations with the help of CSS3.

Let us see some similar example in which you can animate any object or div below.

It is very easy. You just need to apply some properties of CSS3.
This code is also for those who are not technical. Just apply & enjoy 🙂


img.up-down{
    -webkit-animation: mover 1s infinite  alternate;
    animation: mover 1s infinite  alternate;
}
img.up-down{
    -webkit-animation: mover 1s infinite  alternate;
    animation: mover 1s infinite  alternate;
}
@-webkit-keyframes mover {
    0% { transform: translateY(0); }
    100% { transform: translateY(-20px); }
}
@keyframes mover {
    0% { transform: translateY(0); }
    100% { transform: translateY(-20px); }
}

Example:

Can we make a SVG clickable?

Many people doubt whether we can make an image clickable or not. So the answer is yes. And that too in a very easy way. Please check the codes below carefully.

First of all, write the markup given below.


<object data="/images/yourlogo.svg" type="image/svg+xml" width="100" height="70" class="mylogo" ></object>

Now you need to write this CSS code and done.


a.mysvg:after{
   content: ""; 
   position: absolute; 
   top: 0; 
   right: 0; 
   bottom: 0; 
   left: 0;
}

Example:

This is a very easy way to add hyperlink link on a SVG. I hope you liked this method. 🙂