Learn CSS daily

Generate Your Own Playground

Type any CSS property and get a live, editable playground instantly.

text-align-last
.text-container {
  width: 300px;
  margin: 20px;
}

.justified-text {
  text-align: justify;
  text-align-last: right;
  font-size: 16px;
  line-height: 1.5;
  padding: 10px;
  border: 1px solid #ccc;
  background-color: #f9f9f9;
}

The 'text-align-last' CSS property is used to control the alignment of the last line of a block of text. It works in conjunction with the 'text-align' property, allowing you to specify how the last line should be aligned differently from the rest of the text in the block. This is particularly useful for justified text, where you might want the last line to align to the left, right, or center instead of being justified.

text-align
.container {
  width: 80%;
  margin: auto;
  padding: 20px;
  border: 1px solid #ccc;
  background-color: #f9f9f9;
} 
h1.centered-title {
  text-align: center;
} 
p.left-aligned {
  text-align: left;
} 
p.right-aligned {
  text-align: right;
}

The 'text-align' property in CSS is used to set the horizontal alignment of text within an element. It can take values such as 'left', 'right', 'center', and 'justify', allowing for flexible text presentation in web design.

table-layout
.my-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.my-table th, .my-table td {
  border: 1px solid #ccc;
  padding: 10px;
  text-align: left;
}

.my-table th {
  background-color: #f2f2f2;
}

The 'table-layout' CSS property defines the algorithm used to lay out table cells, rows, and columns. It can take values like 'auto' or 'fixed', where 'fixed' allows for a more predictable layout by setting the widths of columns explicitly, while 'auto' adjusts based on the content. This property is particularly useful for controlling the appearance of tables with varying content sizes.

tab-size
.code-example {
  font-family: monospace;
  background-color: #f0f0f0;
  padding: 10px;
  border: 1px solid #ccc;
}

pre {
  tab-size: 4;
  white-space: pre;
  margin: 0;
}

The 'tab-size' CSS property defines the width of tab characters in a text element. By default, tab characters may have a width of 8 spaces, but using 'tab-size', you can customize this to create a more visually appealing layout for your text. This property is particularly useful in code editors or text areas where alignment is important.

shape-outside
.container {
    width: 80%;
    margin: 20px auto;
}

.float-img {
    float: left;
    shape-outside: circle(50%);
    width: 150px;
    height: 150px;
    margin-right: 20px;
    clip-path: circle(50%);
}

p {
    line-height: 1.6;
}

The 'shape-outside' property allows you to define a shape around which inline content can wrap. This property is particularly useful for creating non-rectangular text flows around images or other elements, enhancing the visual layout of a webpage. It works in conjunction with the 'float' property to achieve the desired effect.