logo
down
shadow

Stack css grid elements


Stack css grid elements

Content Index :

Stack css grid elements
Tag : html , By : appdelivery
Date : November 28 2020, 12:01 PM

I wish did fix the issue. As position:absolute removes items from the normal flow.
Add position:relative to .mainContent so the grid is positioned relative to it.
html, body {
  height: 100% !important;
  margin: 0px;
  padding: 0px;
}

.menyLeft {
}

.mainContent {
  padding-top: 18px;
  padding-bottom: 18px;
  position:relative;
}

.menyRight {
}

.body-grid {
  display: grid;
  grid-gap: 10px;
  grid-template-columns: 0.125fr 1fr 0.125fr;
  grid-template-rows:  100%;
}

.inner-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  grid-auto-rows: 1fr 1fr 1fr 1fr;
  grid-gap: 16px;
}

.inner-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr 1fr;
  grid-gap: 16px;
  position: absolute;
  top: 0;
  z-index: 20;
  width:100%;
}

.inner-grid-item:nth-child(4n) {
  background-color: #20c997 !important;
}

.inner-grid-item:nth-child(3n) {
  background-color: #ffc107 !important;
}

.inner-grid-item2 {
  background-color: rgba(108, 117, 125, 0.8) !important;
}

.inner-grid-item2:nth-child(3n) {
  background-color: rgba(232, 62, 140, 0.8) !important;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<body class="h-100 body-grid">
  <div class="h-100 menyLeft">
    <div class="h-100 bg-primary text-light">
      <div class="sidebar-heading d-flex justify-content-center">
        <h2>Left Menu</h2>
      </div>
    </div>
  </div>
  <div class="h-100 mainContent d-flex flex-column justify-content-center">
    <div class="h-100 inner-grid">
      <div class="h-100 card inner-grid-item bg-secondary">
        <center>
          <h2>0</h2>
        </center>
      </div>
      <div class="h-100 card inner-grid-item bg-secondary">
        <center>
          <h2>1</h2>
        </center>
      </div>
      <div class="h-100 card inner-grid-item bg-secondary">
        <center>
          <h2>2</h2>
        </center>
      </div>
      <div class="h-100 card inner-grid-item bg-secondary">
        <center>
          <h2>3</h2>
        </center>
      </div>
      <div class="h-100 card inner-grid-item bg-secondary">
        <center>
          <h2>4</h2>
        </center>
      </div>
      <div class="h-100 card inner-grid-item bg-secondary">
        <center>
          <h2>5</h2>
        </center>
      </div>
      <div class="h-100 card inner-grid-item bg-secondary">
        <center>
          <h2>6</h2>
        </center>
      </div>
      <div class="h-100 card inner-grid-item bg-secondary">
        <center>
          <h2>7</h2>
        </center>
      </div>
      <div class="h-100 card inner-grid-item bg-secondary">
        <center>
          <h2>8</h2>
        </center>
      </div>
      <div class="h-100 card inner-grid-item bg-secondary">
        <center>
          <h2>9</h2>
        </center>
      </div>
      <div class="h-100 card inner-grid-item bg-secondary">
        <center>
          <h2>10</h2>
        </center>
      </div>
      <div class="h-100 card inner-grid-item bg-secondary">
        <center>
          <h2>11</h2>
        </center>
      </div>
      <div class="h-100 card inner-grid-item bg-secondary">
        <center>
          <h2>12</h2>
        </center>
      </div>
      <div class="h-100 card inner-grid-item bg-secondary">
        <center>
          <h2>13</h2>
        </center>
      </div>
      <div class="h-100 card inner-grid-item bg-secondary">
        <center>
          <h2>14</h2>
        </center>
      </div>
      <div class="h-100 card inner-grid-item bg-secondary">
        <center>
          <h2>15</h2>
        </center>
      </div>
    </div>
    <div class="h-100 inner-grid2">
      <div class="h-100 card inner-grid-item2 bg-secondary">
        <center>
          <h2>a</h2>
        </center>
      </div>
      <div class="h-100 card inner-grid-item2 bg-secondary">
        <center>
          <h2>b</h2>
        </center>
      </div>
      <div class="h-100 card inner-grid-item2 bg-secondary">
        <center>
          <h2>c</h2>
        </center>
      </div>
      <div class="h-100 card inner-grid-item2 bg-secondary">
        <center>
          <h2>d</h2>
        </center>
      </div>
    </div>
  </div>
  <div class="h-100 menyRight">
    <div class="h-100 bg-primary text-light">
      <div class="sidebar-heading d-flex justify-content-center">
        <h2>Right Menu</h2>
      </div>
    </div>
  </div>
</body>

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Stack elements in twitter bootstrap media grid differently


Tag : css , By : nonkelhans
Date : March 29 2020, 07:55 AM
it fixes the issue I assume you're using bootstrap responsive. If you are using an unmodified version than all you need to do is create another media query where every div with a span* class takes on the width of 50%. To be completely consistent with bootstrap, you'd want to incorporate the gridGutterWidth into the style too and remove the margin-left from the first-of-type. Do the correct syntax for the media query based on the css/ less/ sass you are using. This if for sass or scss
Here's some sample CSS to get you started:
@media (min-width: 794px) and (max-width: 1060px) {
div[class*="span"] {
    width: 48%;
    margin-left: 2%;
}
div[class="span"]:first-of-type {
    margin-left: 0;
}
}

Why does bootstrap grid improperly stack these elements?


Tag : html , By : alexandruz
Date : March 29 2020, 07:55 AM
Hope this helps Have you tried applying a .clearfix every 2 col-sm-6 (full 12 columns row) elements:
<div class="col-md-3 col-sm-6" style="background-color: red;">
    <div class="feature-box">
        <div class="feature-item"></div>
        <p class="sub-title">Better Customer Relationships</p>
        <p class="text">Personalized emails connect you with your customers.</p>
    </div>
</div>
<div class="col-md-3 col-sm-6" style="background-color: red;">
    <div class="feature-box">
        <div class="feature-item"></div>
        <p class="sub-title">Set it and Forget It</p>
        <p class="text">Set up a Jaynote campaign once, and automatically engage with every customer.</p>
    </div>
</div>
<!-- apply clearfix -->
<div class="clearfix"></div>

How to stack elements in CSS Grid one on top of another?


Tag : css , By : Pavel K.
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further The h2, h3 and h4 are overlapping each other because that's what you told them to do.
Here's your code:
h2 {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
}

h3 {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
}

h4 {
    font-style: italic;
    grid-column: 2 / 3;
    grid-row: 1 / 2;
}
Wrapper {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto 10rem;
  border: 0.1rem black solid;
}

img {
  width: 10rem;
  height: 10rem;
}

section {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
}

h4 {
  font-style: italic;
}

p {
  text-align: justify;
  grid-column: 1 / 3;
  grid-row: 2 / 3;
}
<Wrapper>
  <img src={img} alt="album" />
  <section>
    <h2>Lorem Ipsum</h2>
    <h3>Sit Amet Consectetur</h3>
    <h4>
      Vero iusto distinctio natus esse quos incidunt nihil consectetur consequatur suscipit
    </h4>
  </section>
  <p>
    Lorem ipsum dolor, sit amet consectetur adipisicing elit. Delectus sit ex et, consectetur consequatur suscipit placeat ut corrupti facere voluptatem ratione, vero iusto distinctio natus esse quos incidunt nihil.
  </p>
</Wrapper>
Wrapper {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto auto 10rem;
  border: 0.1rem black solid;
}

img {
  grid-column: 1 / 2;
  grid-row: 1 / 5;
  width: 10rem;
  height: 10rem;
}

h2 {
  grid-row: 1 / 2;
  grid-column: 2 / 3;
}

h3 {
  grid-row: 2 / 3;
  grid-column: 2 / 3;
}

h4 {
  grid-row: 3 / 4;
  grid-column: 2 / 3;
  font-style: italic;
}

p {
  grid-row: 4 / 5;
  grid-column: 1 / 3;
  text-align: justify;
}
<Wrapper>
  <img src={img} alt="album" />
  <h2>Lorem Ipsum</h2>
  <h3>Sit Amet Consectetur</h3>
  <h4>
    Vero iusto distinctio natus esse quos incidunt nihil consectetur consequatur suscipit
  </h4>
  <p>
    Lorem ipsum dolor, sit amet consectetur adipisicing elit. Delectus sit ex et, consectetur consequatur suscipit placeat ut corrupti facere voluptatem ratione, vero iusto distinctio natus esse quos incidunt nihil.
  </p>
</Wrapper>

How to plot horizontal stack of heatmaps or a stack of grid?


Tag : python , By : George H.
Date : January 01 2021, 05:13 PM
seems to work fine How about making a series of 3d surface plots, with the data your wish to present in contour plotted as facecolor?
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.ticker import LinearLocator
import numpy as np


fig = plt.figure()
ax = fig.gca(projection='3d')

X = np.arange(-5, 5, 0.25)
Z = np.arange(-5, 5, 0.25)
X, Z = np.meshgrid(X, Z)
C = np.random.random(size=40*40*3).reshape((40, 40, 3))
ax.plot_surface(X, np.ones(shape=X.shape)-1, Z, facecolors=C, linewidth=0)
ax.plot_surface(X, np.ones(shape=X.shape), Z, facecolors=C, linewidth=0)
ax.plot_surface(X, np.ones(shape=X.shape)+1, Z, facecolors=C, linewidth=0)

How to stack elements in reverse with css grid without using z-index?


Tag : javascript , By : Ben Brown
Date : March 29 2020, 07:55 AM
This might help you With CSS Grid:
There is a CSS property that Grid Layout adheres to called direction. direction: rtl will give you what you need with a single additional class:
.reverse-order{
  direction: rtl;
}
.normal-order {
    position: absolute;
    text-align: left;
    float: left;
    -webkit-transform: scaleY(-1);
    transform: scaleY(-1);
}
.reverse-order > div {
    position: relative;
    float: right;
    display: block;
    -webkit-transform: scaleY(-1);
    transform: scaleY(-1);
}
Related Posts Related QUESTIONS :
  • How can I stop my parallax div having a blurred background?
  • CSS hover effect to modify another element is not working
  • why section-testimonial is not placing correctly
  • Why doesn't my media screen query work, I can't make my website responsive?
  • Aligning inline-block elements horizontally
  • How do I display TypeScript code in "<code>" tags in an Angular app?
  • How can I change the color of input tag in a form when focusing on it?
  • How do I put a container in a fixed position with its own overflow?
  • How to fix text-alignment
  • Outlook not displaying a portion of HTML
  • Remove radio button text only with CSS
  • How to use "v-if" in Vue.js to render a <span> only if parent div has a specific property?
  • How to Extract just the Date from Angular Material Datepicker
  • @keyframes not working, I have tried everything i can think of
  • Bootstrap fix form to bottom of the page
  • How to hide a list element in html
  • How to stop repeating image
  • How do I prevent the GET method from encoding HTML special characters in the URI?
  • CSS/HTML: How do I change the color of the check mark within the checkbox input?
  • attaching a file path in a html form
  • Flip <canvas> (rotate 180deg) after being published on page
  • Is there an application I can show a client the speed of their site via differring internet connections?
  • Html / Email / Distribution list problem from a noob
  • Inspiring web experiments and technical demos
  • Can I load javascript code using <link> tag?
  • Lisp-style quotation in HTML
  • How to put text float around image like some newspapers' format using CSS?
  • Technical reasons for not having large background images in websites
  • HTML 5 Structure tags demo
  • Angular - String interpolation of undefined variable
  • Is there any way to edit specific Column of table using mat-table in Angular material
  • How can I set a text as a shadow for a heading element?
  • How to fix the forms making the buttons overlap
  • Splitting XML into multiple HTML pages with XSLT?
  • How to justify empty divs in flex container
  • How to blur in CSS only one layer of when you have multiple layers in background-image?
  • Scrollable html table with fixed first row and first column, along with angular material controls within the cells of ta
  • In Django, how to extract ID attribute from html Input tag, WITHOUT using django forms
  • how to fix link tag in html after changing css
  • How do I add a top padding to the second row?
  • Is it possible to split XML into multiple HTML pages with page navigation?
  • AngularJS: responsive height in bootstrap
  • Hide second line of text with CSS
  • repeating-linear-gradient not working in Edge browser and internet Explorer Browser
  • how to make search and form category merges like amazon on bootstrap
  • Bootstrap: Rearranging rows into columns and changing the order of elements
  • How can I move a label under a text box?
  • How save LinearGradient To database
  • How to reposition an image with a linear gradient using css?
  • HTML audio will not play when page opened by batch file
  • CSS Three Tone Diagonal Background
  • How to use slots inside of template components in HTML
  • Using span tags in meta description & title, for dual languages
  • How to make an icon/span selectable by pressing Tab key?
  • Add dynamic margins using UI Kit
  • Add margin-top to textbox
  • What is the correct semantic HTML markup for a title (book, movie, etc.), according to the spec? Is it an <em> tag
  • How to make an animation in Geoserver or in Leaflet
  • Buttons overlapping when shrinking window
  • Stretch an element to the end of the automatically calculated grid, not just the explicit grid
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com