Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Grid Area and Margin ! I Can't do it

Featured Replies

i really try and try to make margin for grid area elements ( 4 pic ) i want to make margin right and margin left with maintaining of centering of elements

i want the 4 pic still in center with left margin and right margin !

code of html

    <div class="image">
        <img class="one" src="images/pic03.jpg" alt="">
        <img class="two" src="images/pic04.jpg" alt="">
        <img class="three" src="images/pic01.jpg" alt="">
        <img class="four"  src="images/pic05.jpg" alt="">
    </div>

code of css

.image {
      min-width: 100%;
      display: grid;
      grid-template-areas: 
      "o th"
      "t f"
      ;

  }

  .image .one {
    display: block;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
      grid-area: o;

      
  }

  .image .two {
    display: block;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    grid-area: t;
}
  
.image .three {
    display: block;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    grid-area: th;
}

.image .four {
    display: block;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    grid-area: f;
}

 

pic01.jpg

pic03.jpg

pic04.jpg

pic05.jpg

You should be able to center by adding justify-content: center; to the .image class and adding whatever margins you need. You might be able to use grid-gap instead of margin to space items out too.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.