Front End Scripts Articles

Page 14 of 47

Set the background color of an element with CSS

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 447 Views

To set the background color of an element, use the background-color property in CSS. This property accepts color values in various formats including color names, hex codes, RGB, and HSL values. Syntax background-color: color-value; Example Here's how to set background colors using different methods: Background Color Example This text has a blue background color. ...

Read More

Set the Background Image Position with CSS

mkotla
mkotla
Updated on 15-Mar-2026 625 Views

To set the background image position, use the background-position property. This CSS property controls where the background image is positioned within its container element. Syntax background-position: horizontal vertical; The property accepts various values including pixels, percentages, and keywords like left, right, center, top, and bottom. Example: Positioning with Pixels This example sets the background image position 80 pixels from the left and centers it vertically: body { ...

Read More

Create a small-caps effect for CSS

Abhinaya
Abhinaya
Updated on 15-Mar-2026 568 Views

To create a small-caps effect in CSS, use the font-variant property with the value small-caps. This transforms lowercase letters into smaller uppercase letters while keeping original uppercase letters at their normal size. Syntax font-variant: small-caps; Example Here's how to apply the small-caps effect to text: .small-caps { font-variant: small-caps; font-size: 18px; ...

Read More

Set the font style with CSS

radhakrishna
radhakrishna
Updated on 15-Mar-2026 218 Views

To set the font style, use the font-style property. This CSS property allows you to make text appear italic, normal, or oblique. Syntax font-style: normal | italic | oblique; Values normal - Default font style (upright text) italic - Slanted version of the font (if available) oblique - Artificially slanted text Example: Italic Font Style You can try to run the following code to set the font-style to italic with CSS: Font Style Example ...

Read More

Usage of font-style property in CSS

Giri Raju
Giri Raju
Updated on 15-Mar-2026 106 Views

The font-style property in CSS is used to specify whether text should be displayed in normal, italic, or oblique style. This property allows you to add emphasis to text by changing its visual appearance. Syntax font-style: normal | italic | oblique; Values normal - Default value. Text is displayed normally italic - Text is displayed in italic style (slanted) oblique - Text is displayed in oblique style (artificially slanted) Example: Basic Font Style Usage ...

Read More

Is there a Microsoft equivalent for HTML5 Server-Sent Events?

George John
George John
Updated on 15-Mar-2026 185 Views

HTML5 Server-Sent Events (SSE) provide real-time communication from server to client. While not natively supported in older Internet Explorer versions, there are Microsoft-compatible alternatives to achieve similar functionality. What are Server-Sent Events? Server-Sent Events allow a web page to receive automatic updates from a server through a persistent HTTP connection. Unlike WebSockets, SSE provides unidirectional communication from server to client only. if (typeof EventSource !== "undefined") { var source = new EventSource("/events"); source.onmessage = function(event) { ...

Read More

What exactly is the pushState state object in HTML?

Jennifer Nicholas
Jennifer Nicholas
Updated on 15-Mar-2026 278 Views

The pushState state object is a JavaScript object that stores data associated with a specific history entry in the browser's history stack. It allows you to save information that can be retrieved when the user navigates back or forward through history. Syntax history.pushState(state, title, url); Parameters state - An object containing data to associate with the history entry title - The title for the new history entry (often ignored by browsers) url - The new URL to display in the address bar Example: Creating History Entries with State ...

Read More

Set the font variant with CSS

Ankitha Reddy
Ankitha Reddy
Updated on 15-Mar-2026 131 Views

The CSS font-variant property controls how text is displayed, allowing you to transform lowercase letters into small capital letters or display text normally. Syntax font-variant: normal | small-caps | inherit; Parameters Value Description normal Default value. Text displays normally small-caps Converts lowercase letters to small capital letters inherit Inherits the font-variant from parent element Example: Using small-caps .small-caps { ...

Read More

How to reconnect to websocket after close connection with HTML?

Nitya Raut
Nitya Raut
Updated on 15-Mar-2026 5K+ Views

WebSockets are designed to maintain persistent connections, but they can close due to network issues, server restarts, or connection timeouts. When a WebSocket connection closes, you need to manually recreate the socket to reconnect. How WebSocket Reconnection Works When a WebSocket connection closes, the onclose event fires. You can handle this event to automatically attempt reconnection by creating a new WebSocket instance and reattaching event listeners. Basic Reconnection Example // Socket Variable declaration var mySocket; const socketMessageListener = (event) => { console.log('Received:', event.data); }; // Connection opened const ...

Read More

Usage of font-size property in CSS

usharani
usharani
Updated on 15-Mar-2026 211 Views

The font-size property in CSS controls the size of text elements. It accepts various units and keywords to specify how large or small text should appear on a webpage. Syntax font-size: value; Font Size Values The font-size property accepts several types of values: Absolute keywords: xx-small, x-small, small, medium, large, x-large, xx-large Relative keywords: smaller, larger Length units: pixels (px), em, rem, points (pt) Percentage: relative to parent element's font size Example: Different Font Size Values ...

Read More
Showing 131–140 of 465 articles
« Prev 1 12 13 14 15 16 47 Next »
Advertisements