Usage of CSS Selector

mkotla
Updated on 23-Jun-2020 15:03:03

294 Views

Use the [attribute] selector to select elements with an attribute, for example, an alt attribute or a target attribute, etc.You can try to run the following code to implement the CSS[attribute] selector,ExampleLive Demo                    img[alt] {             border: 3px solid orange;          }                              

Infinity or Exception in Java When Divide by 0

Arjun Thakur
Updated on 23-Jun-2020 15:00:54

373 Views

Consider the following code snippet where we divide a number by 0.Example Live Demopublic class Tester{    public static void main(String[] args) {       double d = 100;       System.out.println(d/0);    } }OutputInfinityNow consider the following code snippet.Example Live Demopublic class Tester{    public static void main(String[] args) {       int d = 100;       System.out.println(d/0);    } }OutputException in thread "main" java.lang.ArithmeticException: / by zero at Tester.main(Tester.java:5)As you've noted, the Infinity vs ArithmeticException, a different result for similar divide by zero program. The difference lies in floating point arithmetic used in first program and integer arithmetic used in second program.

Set Left Tooltip with CSS

Jennifer Nicholas
Updated on 23-Jun-2020 15:00:44

121 Views

To set left tooltip, use the right CSS property.You can try to run the following code to set left tooltip to a text:ExampleLive Demo           .mytooltip .mytext {          visibility: hidden;          width: 140px;          background-color: orange;          color: white;          z-index: 1;          top: -6px;          right: 100%;          text-align: center;          border-radius: 6px;          padding: 5px 0;          position: absolute;       }       .mytooltip {          position: relative;          display: inline-block;          margin-left: 150px;       }       .mytooltip:hover .mytext {          visibility: visible;       }               Keep mouse cursor over me           My Tooltip text          

Initialize HashSet in Java

Ankith Reddy
Updated on 23-Jun-2020 15:00:21

16K+ Views

A set is a collection which does not allows duplicate values. HashSet is an implementation of a Set. Following are the ways in which we can initialize a HashSet in Java.Using constructor − Pass a collection to Constructor to initialize an HashSet.Using addAll() − Pass a collection to Collections.addAll() to initialize an HashSet.Using unmodifiableSet() − Pass a collection to Collections.unmodifiableSet() to get a unmodifiable Set.Using add() − Using add(element) method of Set.Following is an example of using above ways.ExampleInfinityNow consider the following code snippet.Example Live Demoimport java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; public class Tester{    public ... Read More

Set Navigation Bar to Stay at the Bottom of Web Page with CSS

varun
Updated on 23-Jun-2020 15:00:04

4K+ Views

To set the navigation bar at bottom, use position: fixed property, with bottom property.You can try to run the following code to implement a menu that stays on the bottom, ExampleLive Demo                    ul {             list-style-type: none;             position: fixed;             bottom: 0;             width: 100%;          }          li {             float: left;         ... Read More

Add Arrow in Tooltip with CSS

Rishi Rathor
Updated on 23-Jun-2020 14:57:22

3K+ Views

With CSS, you can add a small arrow to the tooltip, using :after. With that, use the content property as well.You can try to run the following code to add an arrow in the tooltip:ExampleLive Demo           .mytooltip .mytext {          visibility: hidden;          width: 140px;          background-color: blue;          color: #fff;          z-index: 1;          bottom: 100%;          left: 60%;          margin-left: -90px;          text-align: center;     ... Read More

Set Navigation Bar to Stay at the Top with CSS

Chandu yadav
Updated on 23-Jun-2020 14:55:13

287 Views

To set the navigation bar at top, use position: fixed property, with top property.You can try to run the following code to implement a menu that stays on the top, ExampleLive Demo                    ul {             list-style-type: none;             position: fixed;             top: 0;             width: 100%;          }          li {             float: left;           ... Read More

Add Link Dividers in a Navigation Bar with CSS

George John
Updated on 23-Jun-2020 14:51:27

2K+ Views

To add link dividers in a Navigation Bar, use the border-right property for the element.ExampleLive Demo                    ul {             list-style-type: none;             margin: 0;             padding: 0;          }          li {             float: left;             border-right: 1px solid white;          }          li a {             display: block;             padding: 8px;             background-color: orange;          }          li:last-child {             border-right: none;          }                              Home          News          Contact          About          

Float List Items to the Right with CSS

Daniol Thomas
Updated on 23-Jun-2020 14:50:35

3K+ Views

To float the list items to the right, use float: right property in CSS. You can try to run the following code to implement it,ExampleLive Demo                    ul {             list-style-type: none;             margin: 0;             padding: 0;          }          li {             float: left;          }          li a {             display: block;             padding: 8px;             background-color: orange;          }                              Home          News          Contact          About          

Use Enums in Python Classes

Arnab Chakraborty
Updated on 23-Jun-2020 14:47:21

298 Views

There is a module name "enum" in python with the hep of which enum is used in python.#import enum import enum # use enum in class class Car(enum.Enum):    suzuki = 1    Hyundai = 2    Dezire = 3 print ("All the enum values are : ") for c in (Car):    print(c)

Advertisements