Front End Technology Articles - Page 649 of 860

Style every elements that is the last child of its parent with CSS

George John
Updated on 22-Jun-2020 05:58:52

163 Views

To style every elements that is the last child of its parent, use the CSS :last-child selector. You can try to run the following code to implement the :last-child selectorExampleLive Demo                    p:last-child {             background: orange;          }                     This is demo text1.       This is demo text2.       This is demo text3.     Output

Set min-height and max-height of an element using CSS

varun
Updated on 30-Jun-2020 08:03:54

306 Views

To set min-height and max-height of an element using CSS, you can try to run the following code −ExampleLive Demo                    div {             max-height: 550px;             min-height: 450px;             background-color: red;          }                     Below is a div with maximum and minimum height. Resize the web browser to see the effect.       This is demo text. This is demo text. This is demo text.          This is demo text. This is demo text. This is demo text.          This is demo text. This is demo text. This is demo text.          

Set min-width and max-width of an element using CSS

Ankith Reddy
Updated on 22-Jun-2020 05:55:28

447 Views

To set the minimum and maximum width of an element, you can try to run the following codeExampleLive Demo                    div {             max-width: 300px;             min-width: 100px;             background-color: red;          }                     Below is a div with maximum and minimum width. Resize the web browser to see the effect.       This is demo text. This is demo text. This is demo text.          This is demo text. This is demo text. This is demo text.          This is demo text. This is demo text. This is demo text.           Output

Set the height and width of an image using percent with CSS

radhakrishna
Updated on 22-Jun-2020 05:35:38

972 Views

To set the height and width of an image using %, you can try to run the following code −ExampleLive Demo                    img {             height: 50%;             width: 50%;          }                     Sized image in %          

Role of margin property with value auto using CSS

Arjun Thakur
Updated on 22-Jun-2020 05:31:06

224 Views

The margin property with value auto is used to horizontally center the element within its container. You can try to run the following code to implement margin: auto;ExampleLive Demo                    div {             width: 200px;             margin: auto;             border: 2px dashed blue;          }                     This is demo text                This is horizontally centered because it has margin: auto;           Output

Role of margin property with value inherit using CSS

Giri Raju
Updated on 22-Jun-2020 05:24:06

446 Views

The margin property with value inherit is used to inherit an element from the parent element. You can try to run the following code to implement margin: inherit;ExampleLive Demo                    div {             border: 2px solid blue;             margin-left: 50px;          }          p.ex1 {             margin-left: inherit;          }                     Inheriting left margin from the parent element                This is demo text with inherited left margin.           Output

Set the color of the right border using CSS

varma
Updated on 30-Jun-2020 08:05:22

74 Views

To set the color of the right border, use the border-right-color property. You can try to run the following code to implement border-color-property −ExampleLive Demo                    p {             border-style: dotted;             border-right-color: #FFFF00;          }                     This is demo text.     Output

Set the color of the four borders using CSS

Chandu yadav
Updated on 21-Jun-2020 10:23:16

82 Views

To set the color of the four borders, use the border-color property. You can try to run the following code to set border color for all the bordersExampleLive Demo                    p {             border-style: dashed;             border-color: #808000 #800000 #FF0000 #FFFF00;          }                     This is demo text with four colored border.     Output

Set the width of the left border using CSS

seetha
Updated on 21-Jun-2020 10:20:40

71 Views

To set the width of the left border, use the border-left-width property in CSS. You can try to run the following code to implement the border-left-width property −ExampleLive Demo                    p {             border-style: dashed;             border-left-width: 10px;          }                     This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is ... Read More

Set the style of the bottom border using CSS

George John
Updated on 21-Jun-2020 10:18:13

208 Views

To set the style of the bottom border, use the border-bottom-style property. The values for the border you can set is, dotted, double, dashed, solid, etc.ExampleYou can try to run the following code to style bottom borderLive Demo                    p.dotted {border-bottom-style: dotted;}          p.double {border-bottom-style: double;}          p.dashed {border-bottom-style: dashed;}          p.solid {border-bottom-style: solid;}          p.inset {border-bottom-style: inset;}          p.outset {border-bottom-style: outset;}                     Dotted bottom border.       Double bottom border.       Dashed bottom border.       Solid bottom border.       Inset bottom border.       Outset bottom border.     Output

Advertisements