Make Any Color Transparent with CSS Filters

Ankith Reddy
Updated on 13-Mar-2020 13:14:21

1K+ Views

To make any particular color transparent, use Chroma Filter. You can use it with scrollbars also.The following parameter can be used in this filterParameterDescriptionColorThe color that you'd like to be transparent.Implementing the CSS Chroma Filter −Live Demo                         Text Example:       CSS Tutorials    

Import Styles from Another Style Sheet in CSS

Ankith Reddy
Updated on 13-Mar-2020 13:12:01

424 Views

To import styles from another style, use the @import rule. It should appear right at the start of the style sheet before any of the rules, and its value is a URL.You can write it like this     The significance of the @import rule is that it allows you to develop your style sheets with a modular approach. You can create various style sheets and then include them wherever you need them.

Fade Out Left Animation Effect with CSS

Lakshmi Srinivas
Updated on 13-Mar-2020 13:10:43

182 Views

To implement Fade Out Left Animation Effect on an image with CSS, you can try to run the following code −ExampleLive Demo                    .animated {             background-image: url(/css/images/logo.png);             background-repeat: no-repeat;             background-position: left top;             padding-top:95px;             margin-bottom:60px;             -webkit-animation-duration: 10s;             animation-duration: 10s;             -webkit-animation-fill-mode: both;             animation-fill-mode: both;          }          @-webkit-keyframes fadeOutLeft {             0% {                opacity: 1;                -webkit-transform: translateX(0);             }             100% {                opacity: 0;                -webkit-transform: translateX(-20px);             }          }          @keyframes fadeOutLeft {             0% {                opacity: 1;                transform: translateX(0);             }             100% {                opacity: 0;                transform: translateX(-20px);             }          }          .fadeOutLeft {             -webkit-animation-name: fadeOutLeft;             animation-name: fadeOutLeft;          }                           Reload page                function myFunction() {             location.reload();          }          

Usage of CSS Important Rule

George John
Updated on 13-Mar-2020 13:08:40

199 Views

The !important rule provides a way to make your CSS cascade. It also includes the rules that are to be applied always. A rule having a !important property will always be applied, no matter where that rule appears in the CSS document.For example, in the following style sheet, the paragraph text will be black, even though the first style property applied is red −     If you want to make sure that a property always applied, you would add the !important property to the tag. Therefore, to make the paragraph text always red, you should write it as follows ... Read More

Insert Content Before an Element with CSS

karthikeya Boyini
Updated on 13-Mar-2020 13:04:46

143 Views

Use the :before element to insert some content before any element. ExampleYou can try to run the following code to insert some content before an element with CSS −Live Demo                    p:before {             content: url(/images/bullet.gif)          }                     This line will be preceded by a bullet.       This line will be preceded by a bullet.       This line will be preceded by a bullet.    

Add Special Style to First Letter of Text in CSS

Chandu yadav
Updated on 13-Mar-2020 13:04:04

127 Views

Use the :first-letter element to add special effects to the first letter of elements in the document. You can try to run the following code to add special styles to the first letter of text −ExampleLive Demo                    p:first-letter {             font-size: 5em;          }          p.normal:first-letter {             font-size: 10px;          }                     First character of this paragraph will be ... Read More

Usage of CSS First Line Pseudo Element

Samual Sam
Updated on 13-Mar-2020 13:03:22

73 Views

Use this element to add special styles to the first line of the text in a selector. The following example demonstrates how to use the :first-line element to add special effects to the first line of elements in the document.ExampleLive Demo                    p:first-line {             text-decoration: underline;          }          p.noline:first-line {             text-decoration: none;          }                     This line would ... Read More

Check if a String is Numeric in Java

Chandu yadav
Updated on 13-Mar-2020 13:01:54

370 Views

ExampleYou can check if a given string is Numeric as shown in the following program.Live Demoimport java.util.Scanner; public class StringNumeric {    public static void main(String[] args) {       Scanner sc = new Scanner(System.in);       System.out.println("Enter a string ::");       String str = sc.next();       boolean number = str.matches("-?\d+(\.\d+)?");       if(number) {          System.out.println("Given string is a number");       } else {          System.out.println("Given string is not a number");       }    } }OutputEnter a string :: 4245 Given string is a number

Convert Stack Trace to String in Java

karthikeya Boyini
Updated on 13-Mar-2020 13:01:05

318 Views

The Java.io.StringWriter class is a character stream that collects its output in a string buffer, which can then be used to construct a string. Closing a StringWriter has no effect.The Java.io.PrintWriter class prints formatted representations of objects to a text-output stream.Using these two classes you can convert a Stack Trace to a String.ExampleLive Demoimport java.io.PrintWriter; import java.io.StringWriter; public class StackTraceToString {    public static void main(String args[]) {       try {          int a[] = new int[2];          System.out.println("Access element three :" + a[3]);       } catch (ArrayIndexOutOfBoundsException e) ... Read More

Convert File Contents to Byte Array and Vice Versa in Java

Ankith Reddy
Updated on 13-Mar-2020 12:56:11

321 Views

The FileInputStream class contains a method read(), this method accepts a byte array as a parameter and it reads the data of the file input stream to given byte array. Assume the file myData contains the following data −Exampleimport java.io.File; import java.io.FileInputStream; public class FileToByteArray {    public static void main(String args[]) throws Exception{       File file = new File("myData");       FileInputStream fis = new FileInputStream(file);       byte[] bytesArray = new byte[(int)file.length()];       fis.read(bytesArray);       String s = new String(bytesArray);       System.out.println(s);    } }OutputHi how are you welcome to Tutorialspoint

Advertisements