Monthly Archives: July 2022

How To Set Horizontal & Vertical Align?

Center Align Elements To horizontally center a block element (like <div>), use margin: auto; Setting the width of the element will prevent it from stretching out to the edges of its container. The element will then take up the specified width, and the remaining space will be split equally between the two margins: Example <!DOCTYPE html>… Read More »

Category: CSS

Display: inline-block

The display: inline-block Value Compared to display: inline, the major difference is that display: inline-block allows to set a width and height on the element. Also, with display: inline-block, the top and bottom margins/paddings are respected, but with display: inline they are not. Compared to display: block, the major difference is that display: inline-block does not add a line-break after the element, so the… Read More »

Category: CSS

CSS Layout float and clear

The CSS float property specifies how an element should float. The CSS clear property specifies what elements can float beside the cleared element and on which side. The float Property The float property is used for positioning and formatting content e.g. let an image float left to the text in a container. The float property can have one of the following values: left –… Read More »

Category: CSS

Set Overflow in div using CSS

CSS Overflow The overflow property specifies whether to clip the content or to add scrollbars when the content of an element is too big to fit in the specified area. The overflow property has the following values: visible – Default. The overflow is not clipped. The content renders outside the element’s box hidden – The overflow is clipped, and the rest… Read More »

Category: CSS

How Set Position Using CSS?

The position property specifies the type of positioning method used for an element (static, relative, fixed, absolute or sticky). The position Property The position property specifies the type of positioning method used for an element. There are five different position values: static relative fixed absolute sticky Elements are then positioned using the top, bottom, left, and right properties. However,… Read More »

Category: CSS

CSS Layout display Property

The display property is the most important CSS property for controlling layout. The display Property The display property specifies if/how an element is displayed. Every HTML element has a default display value depending on what type of element it is. The default display value for most elements is block or inline. Block-level Elements A block-level element always starts on a new line… Read More »

Category: CSS

How To Set Z-index using CSS?

The z-index property specifies the stack order of an element. The z-index Property When elements are positioned, they can overlap other elements. The z-index property specifies the stack order of an element (which element should be placed in front of, or behind, the others). An element can have a positive or negative stack order: Because the image has a… Read More »

Category: CSS

CSS Layout – width and max-width

Using width, max-width and margin: auto; As mentioned in the previous chapter; a block-level element always takes up the full width available (stretches out to the left and right as far as it can). Setting the width of a block-level element will prevent it from stretching out to the edges of its container. Then, you can set… Read More »

Category: CSS

Style Table Using CSS.

Table Borders To specify table borders in CSS, use the border property. The example below specifies a solid border for <table>, <th>, and <td> elements: Example <!DOCTYPE html> <html> <head> <style> table, th, td {  border: 1px solid; } </style> </head> <body> <h2>Add a border to a table:</h2> <table>  <tr>    <th>Firstname</th>    <th>Lastname</th>  </tr>  <tr>  … Read More »

Category: CSS

Add CSS On List.

HTML Lists and CSS List Properties In HTML, there are two main types of lists: unordered lists (<ul>) – the list items are marked with bullets ordered lists (<ol>) – the list items are marked with numbers or letters The CSS list properties allow you to: Set different list item markers for ordered lists Set… Read More »

Category: CSS