首页 > 解决方案 > CSS 网格全高

问题描述

如果内容比创建的网格长,如何创建全高 CSS 网格布局?

在示例中,我创建了一个包含 16 行的显式网格,因此我想创建某种隐式网格(具有相同的行尺寸),它可以扩展到身体的整个高度。

display: grid;
position: absolute;
grid-template-columns: repeat(12, 1fr);
grid-template-rows: repeat(16, 100px);
z-index: -1;
width: 100%;

https://codepen.io/dandevri/pen/MXNeZL
正如您在示例中看到的,在某些时候网格线会停止。


提供一些背景信息:我正在处理我的投资组合,并使用网格区域创建了一个特定的主页。在此处查看实时版本: https ://systemdes.github.io/portfolio/和https://systemdes.github.io/portfolio/profile

标签: csslayoutheightcss-grid

解决方案


1fr使网格以 100% 的高度相对于主体定位,然后像对列所做的那样依赖于行:

body {
 position:relative;
}

.grid {
   display: grid;
   position: absolute;
   grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(16, 1fr);
   z-index: -1;
   width:100%;
   height:100%;
}

.grid--bg--line:nth-child(1) {
   grid-area: 1 / 13 / 1 / 1;
   border-bottom: 1px solid #000;
}

.grid--bg--line:nth-child(2) {
   grid-area: 1 / 1 / 17 / 2;
   border-right: 1px solid #000;
}

.grid--bg--line:nth-child(3) {
   grid-area: 1 / 12 / 17 / 13;
   border-left: 1px solid #000;
}

.container {
   width: 75%;
   margin: 0 auto;
   padding-top: 10em;
}
<div class="grid grid--bg">
   <div class="grid--bg--line"></div>
   <div class="grid--bg--line"></div>
   <div class="grid--bg--line"></div>
</div>

<section class="container">
   <p>Ecosystem release freemium facebook seed money entrepreneur validation crowdsource early adopters beta creative. Strategy funding social proof accelerator social media iPad client. Product management low hanging fruit crowdsource branding freemium value proposition accelerator MVP. Bandwidth assets startup funding churn rate rockstar entrepreneur. Mass market creative innovator holy grail agile development seed money growth hacking gamification business-to-business. Alpha disruptive infographic beta angel investor business plan advisor hackathon stealth. Non-disclosure agreement seed money growth hacking business-to-business success. Disruptive rockstar business-to-consumer iteration infrastructure return on investment conversion growth hacking release. Interaction design analytics customer monetization virality series A financing beta agile development supply chain. Sales strategy investor learning curve partnership metrics buyer niche market bandwidth launch party churn rate iteration hypotheses incubator.

Pivot customer graphical user interface marketing technology ownership deployment venture ramen conversion mass market user experience. Market seed round rockstar accelerator ecosystem android business plan iteration series A financing freemium graphical user interface ownership early adopters. Pivot launch party supply chain handshake seed round leverage network effects infographic. Long tail ownership seed round agile development series A financing backing creative churn rate MVP direct mailing ecosystem bandwidth deployment. Android lean startup beta crowdfunding burn rate backing churn rate. Termsheet backing churn rate. Backing early adopters creative gamification validation monetization business-to-consumer social media return on investment mass market traction stealth rockstar. IPhone return on investment low hanging fruit launch party early adopters accelerator hypotheses partner network crowdfunding agile development user experience prototype lean startup. Incubator direct mailing buyer ramen stock business model canvas alpha early adopters business-to-consumer crowdsource. Stealth deployment bandwidth seed money metrics rockstar niche market angel investor partner network virality leverage funding mass market.

Market business-to-business partner network. Funding release innovator mass market traction. Graphical user interface value proposition analytics metrics low hanging fruit alpha android strategy network effects founders stealth. Backing prototype customer business-to-consumer branding direct mailing beta android network effects marketing social media. Customer social proof niche market launch party bandwidth pivot client. Release success focus return on investment business plan network effects channels. Partnership niche market research & development partner network backing user experience vesting period ecosystem responsive web design low hanging fruit advisor creative. Market pivot buzz low hanging fruit customer business plan. Accelerator android founders network effects analytics bandwidth business-to-consumer assets business plan buyer. Termsheet product management business plan business model canvas A/B testing branding.

Innovator metrics business-to-business partnership responsive web design deployment leverage scrum project ramen holy grail client beta founders infrastructure. Accelerator technology validation success. Funding social media alpha agile development gen-z. Startup crowdfunding client user experience focus incubator deployment. Lean startup responsive web design bootstrapping gamification. Disruptive sales infrastructure founders venture value proposition release responsive web design buzz marketing hackathon freemium buyer. Supply chain first mover advantage stealth social media user experience freemium venture. Direct mailing pitch monetization product management validation graphical user interface. Scrum project termsheet success gen-z focus funding stealth value proposition android burn rate supply chain ramen. Startup branding growth hacking pivot innovator return on investment founders network effects incubator vesting period business plan.

Assets stock crowdfunding interaction design angel investor direct mailing freemium infrastructure business-to-consumer incubator social proof seed money. Business model canvas entrepreneur supply chain startup release ecosystem sales branding business-to-business. Agile development metrics market prototype iPhone graphical user interface business model canvas android seed money sales termsheet incubator handshake advisor. Business-to-business bandwidth marketing hypotheses sales non-disclosure agreement business-to-consumer growth hacking prototype value proposition responsive web design. Bootstrapping freemium branding creative. Hackathon prototype stock hypotheses responsive web design disruptive marketing social proof burn rate non-disclosure agreement advisor channels mass market. Founders lean startup series A financing responsive web design crowdsource. Venture return on investment learning curve handshake technology startup seed round rockstar deployment twitter traction. MVP graphical user interface business-to-consumer lean startup seed round scrum project. Client partnership beta churn rate value proposition seed money.
</p>
   <p>Ecosystem release freemium facebook seed money entrepreneur validation crowdsource early adopters beta creative. Strategy funding social proof accelerator social media iPad client. Product management low hanging fruit crowdsource branding freemium value proposition accelerator MVP. Bandwidth assets startup funding churn rate rockstar entrepreneur. Mass market creative innovator holy grail agile development seed money growth hacking gamification business-to-business. Alpha disruptive infographic beta angel investor business plan advisor hackathon stealth. Non-disclosure agreement seed money growth hacking business-to-business success. Disruptive rockstar business-to-consumer iteration infrastructure return on investment conversion growth hacking release. Interaction design analytics customer monetization virality series A financing beta agile development supply chain. Sales strategy investor learning curve partnership metrics buyer niche market bandwidth launch party churn rate iteration hypotheses incubator.

Pivot customer graphical user interface marketing technology ownership deployment venture ramen conversion mass market user experience. Market seed round rockstar accelerator ecosystem android business plan iteration series A financing freemium graphical user interface ownership early adopters. Pivot launch party supply chain handshake seed round leverage network effects infographic. Long tail ownership seed round agile development series A financing backing creative churn rate MVP direct mailing ecosystem bandwidth deployment. Android lean startup beta crowdfunding burn rate backing churn rate. Termsheet backing churn rate. Backing early adopters creative gamification validation monetization business-to-consumer social media return on investment mass market traction stealth rockstar. IPhone return on investment low hanging fruit launch party early adopters accelerator hypotheses partner network crowdfunding agile development user experience prototype lean startup. Incubator direct mailing buyer ramen stock business model canvas alpha early adopters business-to-consumer crowdsource. Stealth deployment bandwidth seed money metrics rockstar niche market angel investor partner network virality leverage funding mass market.

Market business-to-business partner network. Funding release innovator mass market traction. Graphical user interface value proposition analytics metrics low hanging fruit alpha android strategy network effects founders stealth. Backing prototype customer business-to-consumer branding direct mailing beta android network effects marketing social media. Customer social proof niche market launch party bandwidth pivot client. Release success focus return on investment business plan network effects channels. Partnership niche market research & development partner network backing user experience vesting period ecosystem responsive web design low hanging fruit advisor creative. Market pivot buzz low hanging fruit customer business plan. Accelerator android founders network effects analytics bandwidth business-to-consumer assets business plan buyer. Termsheet product management business plan business model canvas A/B testing branding.

Innovator metrics business-to-business partnership responsive web design deployment leverage scrum project ramen holy grail client beta founders infrastructure. Accelerator technology validation success. Funding social media alpha agile development gen-z. Startup crowdfunding client user experience focus incubator deployment. Lean startup responsive web design bootstrapping gamification. Disruptive sales infrastructure founders venture value proposition release responsive web design buzz marketing hackathon freemium buyer. Supply chain first mover advantage stealth social media user experience freemium venture. Direct mailing pitch monetization product management validation graphical user interface. Scrum project termsheet success gen-z focus funding stealth value proposition android burn rate supply chain ramen. Startup branding growth hacking pivot innovator return on investment founders network effects incubator vesting period business plan.

Assets stock crowdfunding interaction design angel investor direct mailing freemium infrastructure business-to-consumer incubator social proof seed money. Business model canvas entrepreneur supply chain startup release ecosystem sales branding business-to-business. Agile development metrics market prototype iPhone graphical user interface business model canvas android seed money sales termsheet incubator handshake advisor. Business-to-business bandwidth marketing hypotheses sales non-disclosure agreement business-to-consumer growth hacking prototype value proposition responsive web design. Bootstrapping freemium branding creative. Hackathon prototype stock hypotheses responsive web design disruptive marketing social proof burn rate non-disclosure agreement advisor channels mass market. Founders lean startup series A financing responsive web design crowdsource. Venture return on investment learning curve handshake technology startup seed round rockstar deployment twitter traction. MVP graphical user interface business-to-consumer lean startup seed round scrum project. Client partnership beta churn rate value proposition seed money.
</p>
   <p>Ecosystem release freemium facebook seed money entrepreneur validation crowdsource early adopters beta creative. Strategy funding social proof accelerator social media iPad client. Product management low hanging fruit crowdsource branding freemium value proposition accelerator MVP. Bandwidth assets startup funding churn rate rockstar entrepreneur. Mass market creative innovator holy grail agile development seed money growth hacking gamification business-to-business. Alpha disruptive infographic beta angel investor business plan advisor hackathon stealth. Non-disclosure agreement seed money growth hacking business-to-business success. Disruptive rockstar business-to-consumer iteration infrastructure return on investment conversion growth hacking release. Interaction design analytics customer monetization virality series A financing beta agile development supply chain. Sales strategy investor learning curve partnership metrics buyer niche market bandwidth launch party churn rate iteration hypotheses incubator.

Pivot customer graphical user interface marketing technology ownership deployment venture ramen conversion mass market user experience. Market seed round rockstar accelerator ecosystem android business plan iteration series A financing freemium graphical user interface ownership early adopters. Pivot launch party supply chain handshake seed round leverage network effects infographic. Long tail ownership seed round agile development series A financing backing creative churn rate MVP direct mailing ecosystem bandwidth deployment. Android lean startup beta crowdfunding burn rate backing churn rate. Termsheet backing churn rate. Backing early adopters creative gamification validation monetization business-to-consumer social media return on investment mass market traction stealth rockstar. IPhone return on investment low hanging fruit launch party early adopters accelerator hypotheses partner network crowdfunding agile development user experience prototype lean startup. Incubator direct mailing buyer ramen stock business model canvas alpha early adopters business-to-consumer crowdsource. Stealth deployment bandwidth seed money metrics rockstar niche market angel investor partner network virality leverage funding mass market.

Market business-to-business partner network. Funding release innovator mass market traction. Graphical user interface value proposition analytics metrics low hanging fruit alpha android strategy network effects founders stealth. Backing prototype customer business-to-consumer branding direct mailing beta android network effects marketing social media. Customer social proof niche market launch party bandwidth pivot client. Release success focus return on investment business plan network effects channels. Partnership niche market research & development partner network backing user experience vesting period ecosystem responsive web design low hanging fruit advisor creative. Market pivot buzz low hanging fruit customer business plan. Accelerator android founders network effects analytics bandwidth business-to-consumer assets business plan buyer. Termsheet product management business plan business model canvas A/B testing branding.

Innovator metrics business-to-business partnership responsive web design deployment leverage scrum project ramen holy grail client beta founders infrastructure. Accelerator technology validation success. Funding social media alpha agile development gen-z. Startup crowdfunding client user experience focus incubator deployment. Lean startup responsive web design bootstrapping gamification. Disruptive sales infrastructure founders venture value proposition release responsive web design buzz marketing hackathon freemium buyer. Supply chain first mover advantage stealth social media user experience freemium venture. Direct mailing pitch monetization product management validation graphical user interface. Scrum project termsheet success gen-z focus funding stealth value proposition android burn rate supply chain ramen. Startup branding growth hacking pivot innovator return on investment founders network effects incubator vesting period business plan.

Assets stock crowdfunding interaction design angel investor direct mailing freemium infrastructure business-to-consumer incubator social proof seed money. Business model canvas entrepreneur supply chain startup release ecosystem sales branding business-to-business. Agile development metrics market prototype iPhone graphical user interface business model canvas android seed money sales termsheet incubator handshake advisor. Business-to-business bandwidth marketing hypotheses sales non-disclosure agreement business-to-consumer growth hacking prototype value proposition responsive web design. Bootstrapping freemium branding creative. Hackathon prototype stock hypotheses responsive web design disruptive marketing social proof burn rate non-disclosure agreement advisor channels mass market. Founders lean startup series A financing responsive web design crowdsource. Venture return on investment learning curve handshake technology startup seed round rockstar deployment twitter traction. MVP graphical user interface business-to-consumer lean startup seed round scrum project. Client partnership beta churn rate value proposition seed money.
</p>
</section>


推荐阅读