![]() |
The Method 1: Using Inline StylesThe basic method is to set the width and height of a In this example, the style attribute is used to set the width to 200px and the height to 100px. Additionally, display: inline-block; is applied to allow the <span> to have width and height properties. Example: HTML
Output: Method 2: Using CSS ClassesTo apply the same width and height styles to multiple <span> elements, you can define a CSS class and then use that class in your HTML. Here, the CSS class .resizable-span is defined with the desired width, height, and other styles. Each <span> with the class resizable-span will inherit these styles. Example: HTML
Output: Method 3: Using FlexboxFlexbox is a powerful layout model in CSS, and it can be utilized to set the width and height of a <span> element while allowing for more complex layouts. In this example, a <div> with the class flex-container is used as a flex container, and the <span> elements within it are given the class resizable-span. The display: flex; property on the container enables the use of Flexbox layout. Example: HTML
Output: |
Reffered: https://www.geeksforgeeks.org
CSS |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 12 |