×

CSS Vertical Align

Vertical Align

The vertical align CSS property describes the cell box of the table and an inline alignment vertically. This property is a self-explanatory and an essential property in CSS. But, it is not easy to implement for many beginners.

Working

  • The vertical align property can be used for inline-block or inline elements.
  • These properties do not affect the content of the element, but its alignment (excluding table-cells).
  • It also does not affect the table cell itself, but the content of the cell when we use this property on any table cell.

Property Values

ValueDescriptionbaselineThis value is used to align the element’s baseline along with the parent element’s baseline. It is used as the default value.lengthThe length value increases and decreases the element’s length using a specified length value. Negative values can also be used in this property.%The percent value increases and decreases so many elements using a percent value. Negative values can also be used in this property.subIf it has been subscripted, it aligns various elements.superIf it has been subscripted, it aligns multiple elements.topThe top value can be defined to align the element’s top using the tallest element over the line.bottomThe bottom value is described to align the element’s bottom using the lowest element over the line.text-topThe text-top value is used to align the element’s top with the use of a font of the parent element.middleIn this, an element is positioned in between a parent element.text-bottomThe text-bottom value is applied to align the element’s bottom with the use of a font of the parent element.initialThis property can be set-up as a default value by using this value.inheritIt can acquire the property from its parent element.

Example:

Take a look on the following example of vertical align:

<!DOCTYPE html>
<html>
<head>
<style>
img.top
{
vertical-align: text-top;
}
img.bottom
{
vertical-align: text-bottom;
}
</style>
</head>
<body>
<p><img src= "Flower1.jpg" alt= "Beautiful Flower"/> This is a picture with the default alignment. </p>
<p><img src= "Flower1.jpg" class= "top" alt= "Beautiful Flower"/> This is a picture with the text-top alignment. </p>
<p><img src= "Flower1.jpg" class= "bottom" alt= "Beautiful Flower"/> This is a picture with the text-bottom alignment. </p>
</body>
</html>

Output:     

← Prev Next →


Related Topics

CSS Inline

What is CSS? CSS is an acronym for Cascading Style Sheets. CSS is the language that we use to style an HTML document. It specifies how HTML components should appear. CSS...

4 minutes read.

CSS 2d Transform

Transform property in CSS is used mainly for enhancing the effects and to animate the elements. Transform is an effect that changes the shape, size and position of an element. It helps...

6 minutes read.

CSS Tutorial

CSS refers to the Cascading Style Sheet. CSS is a form of a programming language. In other words, CSS is a language of the style sheet that is utilised for...

9 minutes read.

CSS Word Wrap

Word Wrap in CSS: The word-wrap property in CSS is referred to break any lengthy word and wrap towards the next or following line. It is employed for preventing overflow...

1 minute read.

CSS Descendant Selector

Descendant Selector The Descendant selector in CSS is used to match the descendant components of a particular component. The term descendant depicts nested in whatever place, inside a DOM tree. This...

2 minutes read.

CSS Hover

CSS Hover: CSS :hover is used to select the various elements whenever we point the mouse on these elements. We can also use this selector on all the HTML elements,...

3 minutes read.

Css Box Model

Introduction The Box Model property of CSS is used for design and layout of an html page. In CSS, all the elements has a rectangular box around it, you have to...

5 minutes read.

CSS Loader

CSS Loader The loader is the animation that can alert a visitor regarding the loading of the page. We need to wait for some time. It will be helpful if any...

4 minutes read.

What is CSS

CSS stands for Cascading Style Sheet. It gives an additional style to the HTML document. A cascading style sheet is a language that is designed to define the document formatting...

3 minutes read.

CSS Align

CSS Center Align Elements CSS center align is used to create align by using block element. You should specify margin: auto;properties. The element will take up the specified width and the remaining space....

2 minutes read.

CSS :root selector

CSS :root selector This CSS pseudo-class matches any document’s root element. It chooses the parent of the highest-level inside the document DOM or tree. An element of <html> is always a...

2 minutes read.

CSS Table

CSS table provides better look and feel. There are various properties of CSS table that are given below. border border-collapse padding width height text-align color background-color CSS Table Border You can set...

4 minutes read.

CSS Justify Content

Justify Content: These properties are applied for the alignment of items of a flexible box container if any item does not cover every available space over the main-axis, i.e., horizontally....

4 minutes read.

CSS Text Effects

Text Effects in CSS We can use distinct text effects used inside the HTML document. Few attributes can be applied to insert the text effects. We can also style various web documents...

5 minutes read.

How To Use CSS

You can use CSS(Cascading Style Sheet) in four ways. These are given below: The given above CSS type, in which various technique will be used. These are different from each other and...

2 minutes read.

CSS Text-stroke

Text-stroke Text-stroke CSS property inserts the stroke to any text and gives a decoration option to them also. It describes the stroke’s width and color for various text characters. It is...

2 minutes read.

CSS Page-break-before Attribute

Page-break-before Attribute As its name implies, the page-break-before property is applied to include page break before any element, at the time of printing any document. It adds the page break before...

5 minutes read.

CSS Selector

CSS Selector: There are some selectors used in CSS, which allows us to choose the content we wish to style. Various selectors are considered as the separation of the set...

5 minutes read.

CSS Checkbox style

CSS Checkbox style: It is an element of HTML, which is used to get input from various users. It is difficult to style any checkbox. However, some elements make it...

6 minutes read.

Difference between CSS Grid and CSS Flexbox

The way that information is arranged on a website reveals a lot about you or your company. Organizational abilities are just as important as having the right materials. The design...

3 minutes read.