Web Development Articles

Page 370 of 801

How to set the width of the rule between columns with JavaScript?

Monica Mona
Monica Mona
Updated on 15-Mar-2026 162 Views

The columnRuleWidth property controls the thickness of the vertical line that appears between columns in a multi-column layout. This property works with CSS multi-column layouts created using column-count or column-width. Syntax element.style.columnRuleWidth = "value"; The value can be specified in pixels (px), ems, or keywords like thin, medium, or thick. Example #myID { column-count: 4; column-rule: 4px solid yellow; ...

Read More

How to set column width and column count with JavaScript?

Vikyath Ram
Vikyath Ram
Updated on 15-Mar-2026 818 Views

To set the column width and column count in a single declaration, use the JavaScript columns property. This CSS property is a shorthand that combines column-width and column-count into one convenient declaration. Syntax element.style.columns = "width count"; // or element.style.columns = "width"; element.style.columns = "count"; Parameters width - Minimum width of each column (e.g., "100px", "10em") count - Number of columns (e.g., 2, 3, 4) Example The following example demonstrates how to change column layout dynamically using JavaScript: ...

Read More

Set how many columns an element should span across with JavaScript.

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 432 Views

In this tutorial, we will learn to set how many columns an element should span across with JavaScript. Dividing long paragraphs or articles into many columns improves their readability. The 'column-count' CSS property divides the text into numerous columns. Set the columnSpan property to all if you want the columns to span across in JavaScript. To set how many columns an element should span across with JavaScript, we have multiple ways, and in this tutorial, we will discuss two of them − Set the columnSpan property Use the style.setProperty method ...

Read More

How to set the left margin of an element with JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 5K+ Views

In this tutorial, we will learn how to set the left margin of an element with JavaScript. Margin is the space around an element outside its border. The margin of an element can be on all sides, such as: left, right, top, and bottom. Use the marginLeft property in JavaScript to set the left margin. In this tutorial, we will discuss two approaches to setting the left margin − Using the marginLeft property Using the setProperty method Using the marginLeft property to set the left margin of an ...

Read More

How to create or reset counters with JavaScript?

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 1K+ Views

CSS counters provide a way to automatically number elements on a webpage. In JavaScript, you can create or reset counters using the counterReset property to control counter initialization and reset points. How CSS Counters Work CSS counters use three main properties: counter-reset - Creates or resets a counter counter-increment - Increments the counter value counter() - Displays the counter value in content Basic Counter Example body { ...

Read More

How to set the initial length of a flexible item with JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 476 Views

In this tutorial, we will learn how to set the initial length of a flexible item with JavaScript. Flexbox is a one-dimensional layout model that distributes space among items in an interface and provides flexible item alignment properties. It creates flexible items. Use the flexBasis property in JavaScript to set the initial length of a flexible item. In this tutorial, we will see two approaches to setting the initial length of a flexible item: Using the property style.flexBasis Using the method style.setProperty Using the style.flexBasis Property The style flexBasis is a flexbox property ...

Read More

How to set the type of cursor to display for the mouse pointer with JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 2K+ Views

In this tutorial, we will learn to set the type of cursor for the mouse pointer with JavaScript. To set the type of cursor, use the cursor property in JavaScript. It allows you to change the cursor on the button click. We can even change the type of cursor by using JavaScript. Different types of cursors have different meanings. There are many styles of cursors that can use on our webpage. Let us look at how to set the type of cursor to display for the mouse pointer with JavaScript. Using the Style cursor Property The ...

Read More

How to set an element's display type with JavaScript?

Samual Sam
Samual Sam
Updated on 15-Mar-2026 2K+ Views

In JavaScript, you can control an element's visibility and layout behavior by modifying its display property through the DOM. This property accepts various values like block, inline, flex, or none to hide elements completely. Syntax element.style.display = "value"; Where value can be block, inline, flex, grid, none, or other CSS display values. Example: Hiding an Element You can try to run the following code to set an element's display type with JavaScript: ...

Read More

How to know whether the border and background of empty cells are hidden or not with JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 326 Views

In this tutorial, we will learn how to detect whether empty table cells have hidden borders and backgrounds using JavaScript. This is useful when working with dynamic tables where some cells may be empty. The emptyCells CSS property controls whether borders and backgrounds are displayed for empty table cells. JavaScript provides methods to check and modify this behavior programmatically. Understanding Empty Cells Empty table cells can either show their borders and backgrounds or hide them completely. The empty-cells CSS property has two values: show - Display borders and backgrounds for empty cells (default) hide - ...

Read More

Set whether the flexible items should wrap or not with JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 243 Views

In this tutorial, we will learn how to control whether flexible items should wrap or not using JavaScript's flexWrap property. The flexWrap property determines if flex items should wrap to new lines when there isn't enough space in the container. This is essential for creating responsive layouts. Using the Style flexWrap Property The flexWrap property defines whether flex items wrap within their container. The container must have display: flex for this property to work. The default value is nowrap. Syntax object.style.flexWrap = "nowrap|wrap|wrap-reverse|initial|inherit" Values nowrap − Items will not wrap ...

Read More
Showing 3691–3700 of 8,010 articles
« Prev 1 368 369 370 371 372 801 Next »
Advertisements