Changing Column Width Based on Screen Size Using CSS

AmitDiwan
Updated on 30-Oct-2023 14:41:32

4K+ Views

To change the column width based on screen size, use media queries. Media Queries is used when you need to set a style to different devices such as tablet, mobile, desktop, etc. First, set the div − Lorem ipsum dolor, sit amet consectetur adipisicing elit. Quod, maiores! Set the Initial Width To set the width of the above div, use the width property in CSS − .sample { width: 50%; background-color: lightblue; height: 200px; font-size: 18px; } Change the Column Width Now, to change ... Read More

Change Image Opacity on Mouse Over

AmitDiwan
Updated on 30-Oct-2023 14:39:30

2K+ Views

Use the opacity property with the :hover selector to change the opacity on mouse-over. The following is the code to change image opacity on mouse over. Change the image Opacity The following is the image we need to change the opacity on mouse over. We have used the element to set the image − The image class is set with the opacity property value as 1 initially i.e., the actual image − .transparent{ width:270px; height:200px; opacity: 1; transition: 0.3s; } The opacity ... Read More

Change Cursor Color with CSS Caret Color

AmitDiwan
Updated on 30-Oct-2023 14:37:25

2K+ Views

The cursor can be easily changed in CSS. For that, use the caret-color property. This will allow you to change the color in textarea, input, etc. The following examples illustrate the CSS caret-color property to change the cursor color on a web page. Change the Cursor Color of the Input Element The input is the field where data is entered by the user. To change the cursor color, the is set with the caret-color property − input { font-size: 3em; caret-color: chartreuse; margin: 2%; } Here is ... Read More

Change Bullet Color for Lists with Marker CSS Selector

AmitDiwan
Updated on 30-Oct-2023 14:34:44

1K+ Views

The ::marker selector is used to select the marker of a list item in CSS. It updates the marker properties on bullets or numbers i.e., unordered or ordered lists. We will use the ::marker selector with the color property to change the bullet color. Syntax The syntax of CSS ::marker selector is as follows − Selector::marker { attribute: /*value*/; } The following examples illustrate CSS ::marker selector. Create a Colored Vertical Bullet List To add a color to the bullet list, set the ::marker selector. The bullet lists get displayed vertically by default. Here, we ... Read More

Center Image Using text-align: center in CSS

AmitDiwan
Updated on 30-Oct-2023 14:31:57

2K+ Views

The text-align center is generally used to center text of an element. However, we can also center an image using the same text-align property. First, let us see how to center align a text, then we will center an image using the text-align. Additionally, we will also align an image horizontally and vertically as well. Center a Text Using the Text-align Property in CSS Let us first see how to center a heading using the text-align property − h1 { text-align: center; } Example Let us now see the example to center a text on ... Read More

Center Alignment Using the Margin Property in CSS

AmitDiwan
Updated on 30-Oct-2023 14:25:16

2K+ Views

We can center horizontally a block-level element by using the CSS margin property, but CSS width property of that element should be set. The auto value is set for the margin property. Let’s see some examples to center an element using the CSS margin property − Create a Symbol and Align to the Center In this example, we have created a symbol with CSS. The alignment is done to the center using the margin property with value auto − div { width: 50%; margin: 10px auto; border:4px solid black; } ... Read More

Building Tooltip Using CSS

AmitDiwan
Updated on 30-Oct-2023 14:22:30

142 Views

A tooltip is used to set extra information. This is visible on the web page when visitor moves the mouse pointer over an element. The tooltip text can be given directions such as top, bottom, right, and left. Create a Tooltip To create a tooltip, create a Tooltip container and set the text for the Tooltip in it. The Tooltip text is set using the − Hover over me Some toolTip text The Tooltip is positioned using the position property − position: relative; However, the Tooltip text ... Read More

Controlling Dimensions of Flex Items in CSS

AmitDiwan
Updated on 30-Oct-2023 14:19:24

191 Views

To control the dimensions of Flex Items in CSS, use the flex property. Consider flex as the length on flexible items. The flex includes the following properties − flex-grow − A number is set for the flex grow factor i.e., how much the item will grow relative to the other flexible items. flex-shrink − A number is set for the flex skrink factor i.e., how much the item will shrink relative to the other flexible items. flex-basis − The initial size of a flex item. Control the Dimensions of Flex Items With the Shorthand Property We have set ... Read More

Controlling the Visibility of Elements using CSS

AmitDiwan
Updated on 30-Oct-2023 14:12:27

579 Views

CSS visibility property is used to specify a value corresponding to whether the element will be visible or not in the document. Though the element is rendered but if CSS Visibility is set to hidden then it is not made visible. The following are the CSS Visibility values used to control the element’s visibility − Sr.No Value & Description 1 VisibleIt is default, element and its children are visible 2 hiddenIt hides the element and its children are invisible, but element is still rendered and given appropriate space on the page 3 ... Read More

Changing the Position of List Markers in CSS

AmitDiwan
Updated on 30-Oct-2023 14:03:31

6K+ Views

The CSS list-style-position property is used to set the marker position of list items. The default value for this property is outside which sets the marker outside the list item. It is having the following values − inside − The bullet points are positioned inside the list item outside − Default. The bullet points are positioned outside the list item Syntax The syntax of CSS list-style-position property is as follows − Selector { list-style-position: /*value*/ } The following examples illustrate CSS list-style-property − Position List Markers Outside the List Items We have positioned ... Read More

Advertisements