×

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

How to change font size in CSS

How to change font size in CSS? Font Size: - Users may attract attention to content on a website page in various ways. One element in a sentence can be highlighted. You...

5 minutes read.

CSS Image Gallery

Image galleries are used to display and store collections of images. Example Let’s discuss an example. CSS was used to create the following image gallery: Code is as follows: <html> <head> <style> div.gallery {   margin: 6px;   border: 1px...

5 minutes read.

How to use google fonts in CSS

Fonts: - Fonts are used to make our website look more beautiful. Choosing appropriate font according to the web design or layout is also important. Many typefaces are accessible in...

4 minutes read.

CSS User Interface

Introduction User Interface can be defined as series of visual elements like screens, buttons, forms that help the user interact with the software application or hardware device. CSS User Interface allows the...

6 minutes read.

What is CSS used for

What is CSS used for? CSS stands for Cascading Style Sheet. CSS is a stylesheet language for web pages. It specifies how a document created in a markup language looks and...

4 minutes read.

How to center a button in CSS

How to center a button in CSS? In the tutorial, we will learn how to center a button in CSS. CSS (Cascading Style Sheets) gives an HTML web page the greatest possible...

4 minutes read.

CSS Functions

CSS functions are used for different CSS properties. Every front-end developer should have knowledge of all CSS functions. It makes the coding easier. FunctionsExplanationattr().It returns the value of an attribute of...

5 minutes read.

CSS Background Color

It is one of the CSS properties to apply styling to html elements.This property is used to apply the background color to any HTML element.The background of an element includes...

2 minutes read.

How to change the font in CSS

How to change the font in CSS? Professionals can't deny typefaces — how users organize and style text — if we want to completely customize the website's design. One may wish...

4 minutes read.

How to make smooth bounce animation using CSS

The smooth bouncing animation project is done with the help of HTML and CSS. This project gives so much fun and excitement to the users. What is HTML? The HTML or HyperText...

2 minutes read.

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,...

2 minutes read.

CSS Introduction

CSS stands for Cascading Style Sheet. It is a design language which is used to design the web pages. It was developed by Håkon Wium Lie on October 10, 1994. It provides...

1 minute read.

CSS Specificity

CSS Specificity: If one or more conflicting rules of CSS express a similar element, a browser will pursue a few rules to examine the specific one. Specificity can be specified...

3 minutes read.

CSS Animation

CSS Animation: The animation property of CSS is applied to make animation over any webpage. It is used as the animation replacement made by JavaScript and Flash. Rules of CSS3 @keyframes The...

3 minutes read.

Divi in CSS

Divi is popular WordPress themes due to its versatility and user-friendly interface. It includes a built-in page builder for sophisticated design options and an assortment of customization features to help...

9 minutes read.

CSS Form

You can create attractive HTML form by using CSS. Style input Fields The Input Field width properties are used to determine the width of the input field. Let us see an example of CSS style...

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 Zoom

CSS Zoom: Zoom property in CSS extents the content. This property controls the content’s level of magnification. Rather than the use of this CSS property, we may also apply the...

3 minutes read.

CSS 3D Transform

Introduction To understand 3D transformation property of transform you need to first understand the difference between 2D and 3D transform. 2D transform is a CSS effect which transforms the elements according to...

6 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.