div+css实现手风琴响应式折叠文字效果代码

代码语言:html

所属分类:响应式

代码描述:div+css实现手风琴响应式折叠文字效果代码

代码标签: div css 手风琴 响应式 折叠 文字

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  
  
  
<style>
.ui-blinds {
	--ui-blinds-bg: hsl(298, 35%, 37%), hsl(226, 35%, 45%), hsl(129, 35%, 45%), hsl(57, 85%, 50%), hsl(31, 75%, 50%), hsl(3, 65%, 50%);
	--ui-blinds-c: white, white, black, black, black, white;
	--ui-blinds-items: 6;
	--ui-blinds-pb: 1ch;
	--ui-blinds-pi: 2ch;
	--_i: 0;

	container-type: inline-size;

	& ul {
		all: unset;
		clip-path: inset(0% 0% 0% 0% round var(--ui-blinds-bdrs, 0.5em));
		display: grid;

		& li {
			background: linear-gradient(
				var(--ui-blinds-bg)) no-repeat 0 calc(var(--_i) * 100% / 
				(var(--ui-blinds-items) - 1)) / 100% calc(1px * infinity);
			list-style: none;
			padding: var(--ui-blinds-pb) var(--ui-blinds-pi);

			&:nth-of-type(2) { --_i: 1; }
			&:nth-of-type(3) { --_i: 2; }
			&:nth-of-type(4) { --_i: 3; }
			&:nth-of-type(5) { --_i: 4; }
			&:nth-of-type(6) { --_i: 5; }

			& > * {
				background: linear-gradient(
				var(--ui-blinds-c)) no-repeat 0 calc(var(--_i) * 100% / 
				(var(--ui-blinds-items) - 1)) / 100% calc(1px * infinity);
				-webkit-background-clip: text;
				-webkit-text-fill-color: transparent;
			}
			& [role=heading] {
				font-size: var(--ui-blinds-heading-fz, 1.17em);
				text-decoration: none;
			}
			&:not(:target) {
				& [role=heading] {
					block-size: 100%;
					display: block;
					padding-inline: var(--ui-blinds-pb);
					& + * { display: none; }
				}
			}
		}
		@container (min-width: 600px) { 
			grid-auto-flow: column;
			& li:not(:target) {
				box-shadow: var(--ui-blinds-bxsh, -0.25em 0 1em -0.5em rgba(0,0,0,0.5));
				padding: var(--ui-blinds-pb);
				writing-mode: vertical-lr;
			}
		}
	}
}

body {
  font-family: Avenir, Montserrat, Corbel, 'URW Gothic', source-sans-pro, sans-serif;
  margin-inline: auto;
  max-inline-size: 800px;
}
</style>


  
  
</head>

<body >
  <div class="ui-blinds">
  <ul>
    <li id="aboutus">
      <a role="heading" aria-level="2" href="#aboutus">About Us</a>
      <p>
        At Acme Software, we are dedicated to providing exceptional solutions for all your needs. With years of industry experience, we pride ourselves on delivering innovative and reliable products and services to our valued customers. Our team of experts is committed to exceeding expectations and building long-lasting relationships. We strive to stay at the forefront of technological advancements, ensuring that we consistently meet the evolving demands of our clients. Trust Acme Software for unmatched quality, expertise, and customer satisfaction.
      </p>
    </li>
    <li id="ourproducts">
      <a role="heading" aria-level="2" href="#ourproducts">Our Products</a>
      <p>
        Acme Software offers a diverse range of high-quality products designed to cater to your specific requirements. From cutting-edge electronics to innovative home appliances, we have it.........完整代码请登录后点击上方下载按钮下载查看

网友评论0