Select Specific Elements like p with CSS

Anvi Jain
Updated on 24-Jun-2020 06:56:23

142 Views

To select elements, use the element selector. You can try to run the following code to select elements:ExampleLive Demo                    p {             color: blue;             background-color: orange;          }                     Demo Website       Learning       Tutorials on web dev, programming, database, networking, etc.       Every tutorials has lessons with illustrations and figures.    

Usage of CSS Transition Timing Function Property

Ankith Reddy
Updated on 24-Jun-2020 06:55:46

59 Views

Use the transition-timing-function property to set the speed curve of the transition effect. The values you can set are ease, ease-in, ease-out, linear, etc.You can try to run the following code to set the speed curve of the transition effect with CSSExampleLive Demo                    div {             width: 100px;             height: 100px;             background: red;             transition: width 4s;          }          #effect1 {             transition-timing-function: linear;          }          #effect2 {             transition-timing-function: ease-in;          }          div:hover {             width: 250px;          }                     Transition Effect       Hover over the div elements and see the transition effect and the speed:       linear effect       ease-in effect    

Set Right Tooltip with CSS

George John
Updated on 24-Jun-2020 06:54:59

114 Views

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

Position Tooltips Correctly with CSS

Nitya Raut
Updated on 24-Jun-2020 06:54:07

6K+ Views

To position tooltips correctly, use the right, left, top and bottom properties.Let us see how to position tooltips on the right:ExampleLive Demo           .mytooltip .mytext {          visibility: hidden;          width: 140px;          background-color: blue;          color: #fff;          z-index: 1;          top: -6px;          left: 100%;          text-align: center;          border-radius: 6px;          padding: 5px 0;          position: absolute;       }       .mytooltip {          position: relative;          display: inline-block;       }       .mytooltip:hover .mytext {           visibility: visible;       }               Keep mouse cursor over me           My Tooltip text          

Create a Tooltip with CSS

Arjun Thakur
Updated on 24-Jun-2020 06:53:17

390 Views

You can try to run the following code to create a tooltip visible on mouse over. Use the visibility propertyExampleLive demo           #mytooltip #mytext {          visibility: hidden;          width: 100px;          background-color: black;          color: #fff;          text-align: center;          border-radius: 3px;          padding: 10px 0;          position: absolute;          z-index: 1;       }       #mytooltip:hover #mytext {          visibility: visible;       }               Hover the mouse over me          My Tooltip text          

Specify the Speed Curve of Animation with CSS

George John
Updated on 24-Jun-2020 06:51:50

346 Views

Use the animation-timing-function to set the speed curve of the Animation. You can try to run the following code to achieve thisExampleLive Demo                    div {             width: 150px;             height: 200px;             position: relative;             background-color: yellow;             animation-name: myanim;             animation-duration: 2s;             animation-direction: alternate-reverse;             animation-iteration-count: 3;          }          @keyframes myanim {             from {left: 100px;}             to {left: 200px;}          }          #demo1 {animation-timing-function: ease;}          #demo2 {animation-timing-function: ease-in;}                     ease effect       ease-in effect    

Negative Lookbehind Equivalent in JavaScript

Ankith Reddy
Updated on 24-Jun-2020 06:45:12

99 Views

For a negative look-behind in JavaScript, use the following −(^|[^\])"To replace double quotes, you can use the following −str.replace(/(^|[^\])"/g, "$1'")

Strict Comparison in JavaScript Switch Statement

Priya Pallavi
Updated on 24-Jun-2020 06:44:25

155 Views

To get out of the confusion regarding strict comparison, try to run the following code snippet in JavaScript −Exampleswitch(1) {    case '1':       alert('Switch comparison: Not Strict.');       break;    case 1:       alert('Switch comparison: Strict.');       break;    default:       alert(‘Default’); }

Automated Unit Testing with JavaScript

Chandu yadav
Updated on 24-Jun-2020 06:43:52

245 Views

To perform unit testing in JavaScript, use Unit.js. It is a cross-platform open-source unit testing framework.ExampleLet’s say the following in your test code −var example = ‘Welcome’; test.string(example) .isEqualTo(‘Welcome’);The function demo() displays a suit of tests, whereas demo1() is an individual test specification,demo('Welcome’, function() {    demo1('Welcome to the website', function() {       var example = ‘Welcome’;       test.string(example)       .isEqualTo(‘Welcome’);    }); });

Display JavaScript Variables in HTML Without document.write

Sravani S
Updated on 24-Jun-2020 06:42:02

432 Views

Use Element.innerHTML in JavaScript to display JavaScript variables in an HTML page without document.write.You can try to work through the following code snippet −var $myName = document.querySelector('.name'); var $jsValue = document.querySelector('.jsValue'); $myName.addEventListener('input', function(event){    $jsValue.innerHTML = $myName.value; }, false);

Advertisements