Set Image as List Item Marker with JavaScript

Monica Mona
Updated on 23-Jun-2020 13:21:08

164 Views

To set an image as the marker in list-item, use the listStyleImage property in JavaScript.ExampleYou can try to run the following code to set an image as the list-item marker with JavaScript −Live Demo                    One          Two             Update list image                function display() {             document.getElementById("myID").style.listStyleImage = "url('http://tutorialspoint.com/css/images/bullet.gif')";          }          

Set the Position of List Item Marker with JavaScript

Jai Janardhan
Updated on 23-Jun-2020 13:20:40

213 Views

To set the position of the marker of the list-item, use the listStylePosition property. You can try to run the following code to set the position of the list-item marker with JavaScript −ExampleLive Demo                    One          Two             Add list inside       Add list outside                function displayInside() {             document.getElementById("myID").style.listStylePosition = "inside";          }          function displayOutside() {             document.getElementById("myID").style.listStylePosition = "outside";          }          

Set Maximum Height of an Element with JavaScript

Sai Subramanyam
Updated on 23-Jun-2020 13:20:09

736 Views

Use the maxHeight property in JavaScript to set the maximum height. You can try to run the following code to set the maximum height of an element with JavaScript −ExampleLive Demo    #box {       width: 300px;       background-color: gray;       overflow: auto;    } Click below to set Maximum height. Max Height This is a div. This is a div. This is a div. This is a div. This is a div. This is a div. This is a div. This is a div. This is ... Read More

Set Margins of an Element with JavaScript

Swarali Sree
Updated on 23-Jun-2020 13:19:12

271 Views

Use the margin property in JavaScript, to set the margins. You can try to run the following code to set the margins of an element with JavaScript −ExampleLive Demo           Set all four margins       This is demo text.                function display() {             document.getElementById("myID").style.margin = "30px 20px 40px 40px";          }          

Set List Item Marker Type with JavaScript

Fendadis John
Updated on 23-Jun-2020 13:18:44

486 Views

To set the type of the list-item marker type, use the listStyleType property. The marker type can be square, circle, dic, etc.ExampleYou can try to run the following code to set the list-item marker type with JavaScript −Live Demo                    One          Two             Update list style type (square)       Update list style type (decimal)                function displaySquare() {             document.getElementById("myID").style.listStyleType = "square";          }          function displayDecimal() {             document.getElementById("myID").style.listStyleType = "decimal";          }          

Set Bottom Margin of an Element with JavaScript

karthikeya Boyini
Updated on 23-Jun-2020 13:18:11

755 Views

Use the marginBottom property in JavaScript, to set the bottom margin.ExampleYou can try to run the following code to set the bottom margin of an element with JavaScript −Live Demo           This is demo text.       Set bottom margin                function display() {             document.getElementById("myID").style.marginBottom = "95px";          }          

Best Way to Detect a Touch Screen Device Using JavaScript

Chandu yadav
Updated on 23-Jun-2020 13:08:10

727 Views

The best way to detect a ‘touch screen’ device, is to work around to see whether the touch methods are present within the document model or not.function checkTouchDevice() {    return 'ontouchstart' in document.documentElement; }Here, you can also use it to detect mobile or desktop, like the following −if (checkTouchDevice()) {    // Mobile device } else {    // Desktop }

Set Font Style to Normal, Italic, or Oblique with JavaScript

Jai Janardhan
Updated on 23-Jun-2020 13:07:40

133 Views

To set the style of the font, use the fontStyle property. You can try to run the following code to set the style of the font to normal, italic or oblique with JavaScript −ExampleLive Demo           Heading 1                This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text.          This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text.             Set Font Family and Style                function display() {             document.getElementById("myID").style.fontFamily = "verdana,sans-serif";             document.getElementById("myID").style.fontStyle = "italic";          }          

Set Font Boldness with JavaScript

karthikeya Boyini
Updated on 23-Jun-2020 13:07:11

149 Views

Use the fontWeight property in JavaScript to set the font boldness.ExampleYou can try to run the following code to set the boldness of the font with JavaScript −Live Demo           Heading 1                This is Demo Text.             Set Font Family and Font Weight                function display() {             document.getElementById("myID").style.fontFamily = "verdana,sans-serif";             document.getElementById("myID").style.fontWeight = "800";          }          

Set the Height of an Element with JavaScript

Lakshmi Srinivas
Updated on 23-Jun-2020 13:06:43

778 Views

Use the height property to set the height of an element. You can try to run the following code to set the height of a button with JavaScript −ExampleLive Demo           Heading 1       This is Demo Text.       Update Height                function display() {             document.getElementById("myID").style.height = "100px";          }          

Advertisements