Block Level Elements and Block Boxes in CSS

AmitDiwan
Updated on 27-Oct-2023 14:43:09

2K+ Views

Block-level elements have their CSS display property set to either ‘block’, ‘list-item’, or ‘table’ and these elements force a line break above and below themselves. Block-level boxes are generated by each block-level element which is a part of the positioning scheme as well as contains child boxes. Block container boxes contain either block-level boxes and follow block formatting context or contain inline-level boxes and follow inline formatting context. Block boxes is a term used if block-level boxes are also block containers. Anonymous block boxes are those boxes over which developer has no control. If an inline box contains a block ... Read More

Auto Grow a Textarea with JavaScript and CSS

AmitDiwan
Updated on 27-Oct-2023 14:38:37

464 Views

Using JavaScript, we can set our TextArea element to automatically grow with its content. The following examples illustrate how we can achieve the above scenario. Let us say the following is our TextArea before adding content − The following is the TextArea after adding content − The following is the same TextArea that auto grows itself after adding more content − Auto Grow a Textarea Example Let us see how to auto grow a textarea − * { ... Read More

Applying Sepia Effect to Images Using CSS3

AmitDiwan
Updated on 27-Oct-2023 14:37:19

374 Views

The filter property is used to set visual effects, such as drop shadow, contrast, brightness, saturation, shadow to images in CSS. The following is the syntax − Syntax filter: none | drop-shadow() | blur() | brightness() | contrast() | grayscale() | hue-rotate() | invert() | opacity() | saturate() | sepia() | url(); As you can see above, with the filter property, we can set the following effects: contrast, drop shadow, blur, brightness, grayscale, hue-rotate, invert, opacity, saturate, sepia, url. The sepia sets the sepia effect to an image. To set the sepia effect in CSS3, use the ... Read More

Align Elements Using the Position Property in CSS

AmitDiwan
Updated on 27-Oct-2023 14:28:39

79 Views

We can align elements using the CSS positioning schema methods (fixed, relative, absolute and static) and properties (left, right, top and bottom). To align elements in CSS, use the position property. The position can be set using the following values − static relative fixed absolute sticky For example, the following is achieved by aligning divs on a web page using the position property − Align Elements With Absolute and Relative Positions Example Let’s see an example to align elements using the positioning schema. We have shown the absolute and relative positions here − ... Read More

Align Flex Items Along Cross Axis Using CSS3

AmitDiwan
Updated on 27-Oct-2023 14:26:53

167 Views

We can easily align the flex items along cross axis, but first let us understand what cross axis is. The cross axis is perpendicular to the main axis. The main axis is like the flex direction − Create a Container div First, set the divs inside a container(flex container) − First Div Second Div Third Div Style the Container and Make it Flexible The flex container becomes flexible by setting the display property to flex. The flex items are aligned using the align-items property − ... Read More

Advance CSS Layout with Flexbox

AmitDiwan
Updated on 27-Oct-2023 14:23:54

610 Views

CSS3 provides a layout mode Flexible Box, commonly called as Flexbox. Flexbox (flexible box) is a layout mode of CSS3. Using this mode, you can easily create layouts for complex applications and web pages. It includes the container, flex items, etc. The container has the following properties − flex-direction flex-wrap flex-flow justify-content align-items align-content Here are all the Flexbox examples in a single image. It uses the flex, flex-wrap, justify-content, align-items, etc. − Style the Parent Container We have styled the parent container here. The flex container becomes flexible by setting the display property to flex ... Read More

Adjust Image Contrast Using CSS3

AmitDiwan
Updated on 27-Oct-2023 14:18:17

5K+ Views

The filter property is used to set visual effects, such as drop shadow, contrast, brightness, saturation, shadow to images in CSS. The following is the syntax − Syntax filter: none | drop-shadow() | blur() | brightness() | contrast() | grayscale() | hue-rotate() | invert() | opacity() | saturate() | sepia() | url(); As you can see above, with the filter property, we can set the following effects: contrast, drop shadow, blur, brightness, grayscale, hue-rotate, invert, opacity, saturate, sepia, url. To adjust the contrast of an image in CSS3, use the contrast value for filter property. The contrast ... Read More

Adjacent Sibling Selectors in CSS

AmitDiwan
Updated on 27-Oct-2023 14:15:57

1K+ Views

The CSS adjacent sibling selector is used to select the adjacent sibling of an element. It is used to select only those elements which immediately follow the first selector. The + sign is used as a separator. For example, the direct next element is selected here with the adjacent sibling selector concept − Syntax The syntax for CSS adjacent sibling selector is as follows − element + element { /*declarations*/ } Adjacent Sibling Selector Example Example The following example illustrate CSS adjacent sibling selector − ... Read More

Adding Hyphens to Text with the CSS Hyphens Property

AmitDiwan
Updated on 27-Oct-2023 14:13:43

102 Views

Using the CSS hyphens property, we can specify how hyphens are added in text. The hyphens property values can be − none − The words not hyphenated manual − The words are hyphenated at ‐ or ­ The default. auto − The words are hyphenated where the deciding factor is the algorithm The hyphen can be set like this − It can also be set like this. Totally depends on the text form − Let us see some examples − Words are Hyphenated Manually The following example illustrate CSS hyphens property where the word are hyphenated ... Read More

Add Drop Shadow to Images Using CSS3

AmitDiwan
Updated on 27-Oct-2023 14:09:19

9K+ Views

The filter property is used to set visual effects, such as drop shadow, contrast, brightness, saturation, shadow to images in CSS. The following is the syntax − Syntax filter: none | drop-shadow() | blur() | brightness() | contrast() | grayscale() | hue-rotate() | invert() | opacity() | saturate() | sepia() | url(); As you can see above, with the filter property, we can set the following effects: drop shadow, blur, brightness, contrast, grayscale, hue-rotate, invert, opacity, saturate, sepia, url. The drop shadow on an image can look like the following image − To add the drop ... Read More

Advertisements