CSS grid-column-end Property

CSS grid-column-end Property


This property specifies how many columns a element will span,or in other words, This property specifies the end column on which an item will end spanning.
Syntax -

grid-column-end: auto|span n|column-line;

Now we will see the values with their description -

Value

Description

auto

The item will span one column only, and this is the default value.

span n

This specifies the no. of columns the item will span

column-line

This specifies on which column to end spanning

Now we will see the example -

Example -

<html>
  <head>
    <title>Title of the document</title>
    <style>

    .Here  {
  display: grid;
  grid-template-columns: auto auto auto;
  grid-template-rows: auto auto;
  grid-gap: 10px;
  background-color: #2196F3;
  padding: 10px;
  grid-auto-flow: row;
}
.here>div{
border: 4px solid rgb(99, 45, 135);
border-radius: 50px;
background-color: rgb(234, 199, 59);
}

.one{
  grid-column-end: span 2;
}
.four{
  grid-column-end: span 3;

}
.eight{
  grid-column-end: span 3;

}

    </style>
  </head>
  <body>
    <div class="Here">
      <div class="one">one</div>
      <div class="two">two</div>
      <div class="three">three</div> 
      <div class="four">four</div>
      <div class="five">five</div>
      <div class="six">six</div>
      <div class="seven">seven</div> 
      <div class="eight">eight</div> 
      <div class="nine">nine</div> 
    </div>

  </body>
</html>

 

Output -