Posts

Showing posts with the label Html Example

Css Multiple Classes In One Declaration Code Example

Example 1: css multiple classes //HTML Code < div class = ' firstClass secondClass ' > </ div > //CSS Code .firstClass.secondClass { } Example 2: css change multiple classes .objectOne, .objectTwo { /* We will now both be changed */ margin: 0 auto; } Example 3: css assign multiple classes to one element To specify multiple classes, separate the class names with a space, e.g. < span class = " classA classB " > . This allows you to combine several CSS classes for one HTML element.

Css Style Placeholder Text Code Example

Example 1: css placeholder color ::-webkit-input-placeholder { /* Chrome/Opera/Safari */ color: pink; } ::-moz-placeholder { /* Firefox 19+ */ color: pink; } :-ms-input-placeholder { /* IE 10+ */ color: pink; } :-moz-placeholder { /* Firefox 18- */ color: pink; } Example 2: css style placeholder input::-webkit-input-placeholder {/* Chrome/Opera/Safari/Edge */ /*styles here*/ } input::-ms-input-placeholder { /* Microsoft Edge */ /*styles here*/ } input:-ms-input-placeholder {/* IE 10+ */ /*styles here*/ } input::-moz-placeholder {/* Firefox 19+ */ opacity: 1; /*Firefox by default has an opacity object that usually is ideal to reset so it matches webkit*/ /*styles here*/ } input:-moz-placeholder {/* Firefox 18- */ opacity: 1; /*Firefox by default has an opacity object that usually is ideal to reset so it matches webkit*/ /*styles here*/ } input::placeholder { /*styles here*/ } Example 3: css style placeholder <! DOCTYPE html > < html lang = " en ...

Button Type Submit Onclick Preventdefault Code Example

Example 1: prevent button from submitting form function myFunc(e){ e.preventDefault(); } Example 2: prevent button form submit < button type = " button " > Button </ button >

Css Position Relative And Absolute Code Example

Example 1: what are the types of positioning in css The types of positioning in CSS are- 1)static: this is the default value. 2)sticky: the element is positioned based on the user's scroll position. 3)fixed: the element is positioned related to the browser window. 4)relative: the element is positioned relative to its normal position. 5)absolute: the element is positioned absolutely to its first positioned parent. Example 2: absolute css /*hey guys if you have doubt how absolute property works, it works in way that it comes out of the 'document flow' i.e) just consider two div elements in which each a size of a box, say that you need two place the second box over the top box simple just give it absolute position such that the second div positioned itself with respect to the browser window, you can move the element anywhere in the window*/ div{ position:absolute; top:10px; /*it pushes away div element from top 10px down Remember with browser window*/ left:20px; ...

Align Center Image In Bootstrap Code Example

Example 1: bootstrap class align center image class="mx-auto d-block" Example 2: bootstrap Aligning images Align images with the helper float classes or text alignment classes. block-level images can be centered using the .mx-auto margin utility class. < img src = " ... " class = " rounded float-left " alt = " ... " > < img src = " ... " class = " rounded float-right " alt = " ... " > < img src = " ... " class = " rounded mx-auto d-block " alt = " ... " >

Bootstrap4 Cdn With Jquery Code Example

Example: bootstrap 4 cdn <!-- Boostrap 4 CSS --> < link rel = " stylesheet " href = " https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css " integrity = " sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh " crossorigin = " anonymous " > < script src = " https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js " integrity = " sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6 " crossorigin = " anonymous " > </ script > <!-- Boostrap JS --> < script src = " https://code.jquery.com/jquery-3.4.1.slim.min.js " integrity = " sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n " crossorigin = " anonymous " > </ script > < script src = " https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js " integrity = ...

Ajax Google Api Jquery Cdn Code Example

Example 1: jquery cdn google < script src = " https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js " > </ script > Example 2: import jquery google cdn < script src = " https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js " > </ script > Example 3: jqurey cdn < script src = " https://code.jquery.com/jquery-3.5.1.min.js " integrity = " sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0= " crossorigin = " anonymous " > </ script > Example 4: jquery google cdn < script src = " https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js " > </ script >

Css In Head Style Code Example

Example 1: adding css to html < head > <!-- Linking external Css document --> < link rel = " stylesheet " href = " styles.css " > <!-- Writing Css inside HTML element --> < style > ... </ style > </ head > Example 2: adding css to html body Three ways to add CSS to the body of html: 1)External CSS 2)Internal CSS 3)Inline CSS 1) Externally: Type your css code in a file. Remember you file name. Then, < head > < link rel = " stylesheet " type = " text/css " href = " FileName.css " > </ head > 2) Internally: Type your cSS in the html file itself. (It is not preffered until little CSS code is to be added). This can be done by style tag. Example: < head > < style > h1 { text-color : red ; text-size : 0.8 em ; } </ style > </ head > 3) Inline: This method is not used by developers as it is ve...

Css Disabled Input Code Example

Example 1: disable form field with css <! DOCTYPE html > < html > < head > < title > Title of the document </ title > < style > input [ name = name ] { pointer-events : none ; } </ style > </ head > < body > < input type = " text " name = " name " value = " w3docs " > </ body > </ html > Example 2: css disabled < input type = " text " name = " username " value = " admin " > < style type = " text/css " > input [ name = username ] { pointer-events : none ; } </ style > Example 3: css disable input < input type = " text " name = " username " value = " admin " > < style type = " text/css " > input [ name = username ] { disabled : true ; /* Does not work */ } </ style > Example 4: css disable inpu...

Bootstrap Textarea Height Code Example

Example: bootstrap textarea width < textarea class = " form-control " style = " min-width : 100 % " > </ textarea >

Bootstrap4 Panel Code Example

Example: .card class < style > .card { border : 1 px solid #ccc ; background-color : #f4f4f4 ; padding : 20 px ; margin-bottom : 10 px ; } </ style >

Add Column To Existing Table In Postgres Code Example

Example 1: postgresql add column with constraint ALTER TABLE customers ADD COLUMN contact_name VARCHAR NOT NULL; Example 2: alter table add column psql ALTER TABLE table_name ADD column_name data_type column_constraint; Example 3: alter table add multiple columns postgresql ALTER TABLE customer ADD COLUMN fax VARCHAR, ADD COLUMN email VARCHAR; Example 4: alter table add column postgres Alter Postgres Table

Bootstrap Image Left Code Example

Example 1: how to make image responsive bootstrap 4 < img src = " ... " class = " img-fluid " alt = " Responsive image " > Example 2: bootstrap Aligning images Align images with the helper float classes or text alignment classes. block-level images can be centered using the .mx-auto margin utility class. < img src = " ... " class = " rounded float-left " alt = " ... " > < img src = " ... " class = " rounded float-right " alt = " ... " > < img src = " ... " class = " rounded mx-auto d-block " alt = " ... " > Example 3: bootstrap left image right text < div class = " card " > < div class = " row no-gutters " > < div class = " col-auto " > < img src = " //placehold.it/200 " class = " img-fluid " alt = " ...

Bootstrap Code Example

Example 1: how to change the color of the hr tag in html <style > hr { height : 1 px ; background-color : #ccc ; border : none ; } </style> Example 2: html horizontal line style <!-- HTML --> <!-- You can change the style of the horizontal line like this : --> <hr style= "width:50%" , size= "3" , color= black > <!-- Or like this : --> <hr style= "height:2px; width:50%; border-width:0; color:red; background-color:red" > Example 3: how to style an hr tag /* Red border */ hr .new1 { border-top : 1 px solid red ; } /* Dashed red border */ hr .new2 { border-top : 1 px dashed red ; } /* Dotted red border */ hr .new3 { border-top : 1 px dotted red ; } /* Thick red border */ hr .new4 { border : 1 px solid red ; } /* Large rounded green border */ hr .new5 { border : 10 px solid green ; border-radius : 5 px ...

Css Input Remove Focus Border Code Example

Example 1: css remove border input focus textarea:focus, input:focus{ outline: none; } Example 2: remove blue border on a input input:focus { outline: none !important; } Example 3: input outline focus input:focus, textarea:focus { background-color: #FFFF66; border: 1px solid #F47E58; } Example 4: how to remove input field border outline on focus css outline = none;

Ajax Cdn Code Example

Example 1: ajax cdn < script src = " https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js " > </ script > Example 2: jquery cdn google < script src = " https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js " > </ script > Example 3: jqeury cdn //Note: This is for version 3.5.0. You can change it here \/ < script src = " https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js " integrity = " sha256-xNzN2a4ltkB44Mc/Jz3pT4iU1cmeR0FkXs4pru/JxaQ= " crossorigin = " anonymous " > </ script > Example 4: jquery script tag < script src = " https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js " > </ script > // Put this script in the head of your index.html to load jQuery // The Google Hosted Libraries is a stable, reliable, high-speed, // globally available content distribution network for the most popular, // open-source Jav...

Addeventlistener Load Code Example

Example 1: window.onload window.onload = function() { // Some code }; Example 2: javascript document load window.addEventListener("load", function(event) { console.log("Tutte le risorse hanno terminato il caricamento!"); }); Example 3: document.addEventListener("load", function () { window.addEventListener('load', (event) => { console.log('page is fully loaded'); }); window.onload = (event) => { console.log('page is fully loaded'); }; Example 4: js document onload //use window.onload=()=>{}; Example 5: window onload function load(argument) { // body... } window.onload = load;

Css Em Vs Rem Code Example

Example 1: rem vs em em -> is relative to the font-size of its direct or nearest parent rem -> is relative to the html (root) font-size Example 2: em vs rem 1EM or 1REM (r = root em) The difference is inheritance. The Rem value is based on the root element (html). What is meant here is the font size for html and not the font size for the documet body. ... Em is based on the font size of each Parent element. Example 3: rem vs em /* rem */ Translation of rem units to pixel value is determined by the font size of the html element. This font size is influenced by inheritance from the browser font size setting unless explicitly overridden with a unit not subject to inheritance (px or vw). /* em */ Translation of em units to pixel values is determined by the font size of the element they’re used on. This font size is influenced by inheritance from parent elements unless explicitly overridden with a unit not subject to inheritance. ---> change the menu’s font size the spacing (pad...

Bootstrap Start Documentation Starter Template Code Example

Example 1: bootstrap 4 cdn <!-- Boostrap 4 CSS --> < link rel = " stylesheet " href = " https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css " integrity = " sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh " crossorigin = " anonymous " > < script src = " https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js " integrity = " sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6 " crossorigin = " anonymous " > </ script > <!-- Boostrap JS --> < script src = " https://code.jquery.com/jquery-3.4.1.slim.min.js " integrity = " sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n " crossorigin = " anonymous " > </ script > < script src = " https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js " integrity = ...

3js Examples

Example: three js examples /* Answer to: "three js examples" */ /* You can find hundreds of examples here: https://threejs.org/examples/ Here's a list of different sections of the examples in that list: - webgl - webgl / nodes - webgl / postprocessing - webgl / advanced - webgl2 - webaudio - webxr - physics - misc - css2d - css3d - svg - tests */