height 相关问题

确定Y轴上对象大小的属性。请不要使用此标记,它在您的帖子中没有分类值。

CSS 计算和乘法

我知道这可能有一个明显的答案,但我很困惑。 我一直在尝试创建自定义计算来根据元素的像素确定确切的百分比,例如: .el...

回答 1 投票 0

在 tailwind css 中如何为具有指定 text-4xl 大小的空 div 设置最小高度

我需要像 min-h-4xl 这样的东西,所以当 div 的上下文为空时,它仍然与带有文本的其他 div 具有相同的高度。 因此,当没有表情符号(文本)时,我需要保持相同的大小。 https://

回答 1 投票 0

如何将卡片列表的高度设置为100%?

我有一个网格卡列表,但我无法设置它们的高度,请帮助我 设置卡片列表的高度不起作用,虽然我也设置了父元素的高度 我有网格卡列表,但我无法设置它们的高度,请帮助我 设置卡片列表的高度不起作用,虽然我也设置了父元素的高度 <div class="desc-grid__body cards-grid"> <ul class="cards-grid__list"> <li class="cards-grid__item"> <div class="cards-grid__short-card short-card"> <p class="short-card__content"> <span class="short-card__lable">Более</span> <span class="short-card__title">16 лет</span> <span class="short-card__desc">экспертизы</span> </p> </div> </li> <li class="cards-grid__item"> <div class="cards-grid__short-card short-card"> <p class="short-card__content"> <span class="short-card__lable">Более</span> <span class="short-card__title">10 000</span> <span class="short-card__desc">заявок ежедневно </span> </p> </div> </li> <li class="cards-grid__item "> <div class="cards-grid__short-card short-card"> <p class="short-card__content"> <span class="short-card__lable">Более</span> <span class="short-card__title">1 000</span> <span class="short-card__desc">Компетентных специалистов</span> </p> </div> </li> <li class="cards-grid__item"> <div class="cards-grid__short-card short-card"> <p class="short-card__content"> <span class="short-card__lable">Более</span> <span class="short-card__title">24 / 7 / 365</span> <span class="short-card__desc">управления сервисными работами</span> </p> </div> </li> </ul> </div> 您是否尝试过为 .cards-grid__item 提供高度? 只需添加.cards-grid__item { height: 100px; background:red;}即可工作 .cards-grid__item { height: 100px; background:red;} <div class="desc-grid__body cards-grid"> <ul class="cards-grid__list"> <li class="cards-grid__item"> <div class="cards-grid__short-card short-card"> <p class="short-card__content"> <span class="short-card__lable">Более</span> <span class="short-card__title">16 лет</span> <span class="short-card__desc">экспертизы</span> </p> </div> </li> <li class="cards-grid__item"> <div class="cards-grid__short-card short-card"> <p class="short-card__content"> <span class="short-card__lable">Более</span> <span class="short-card__title">10 000</span> <span class="short-card__desc">заявок ежедневно </span> </p> </div> </li> <li class="cards-grid__item "> <div class="cards-grid__short-card short-card"> <p class="short-card__content"> <span class="short-card__lable">Более</span> <span class="short-card__title">1 000</span> <span class="short-card__desc">Компетентных специалистов</span> </p> </div> </li> <li class="cards-grid__item"> <div class="cards-grid__short-card short-card"> <p class="short-card__content"> <span class="short-card__lable">Более</span> <span class="short-card__title">24 / 7 / 365</span> <span class="short-card__desc">управления сервисными работами</span> </p> </div> </li> </ul> </div> 希望你能得到你想要的东西.. 谢谢...

回答 1 投票 0

在添加到 DOM 之前获取元素的高度

有什么方法可以在将元素附加到 DOM 之前获取其高度吗?我知道 clientHeight 不能像我尝试的那样工作,它总是返回 0。是否有其他方法可以返回

回答 3 投票 0

我用java编写了一个递归方法来计算一棵树的高度,我的问题是如何让这个方法一次打印高度

所以这是我的方法: 公共 int getHeight(IntTreeNode root) { 如果(根==空){ 返回0; } int height = 1 + Math.max(getHeight(root.left), getHeight(root.right...

回答 1 投票 0

如何强制我的列始终拉伸到页面底部?

我需要我的内容列在内容短于视口时扩展到页面底部,但在内容较长时仍然扩展。该专栏必须下降一点...

回答 6 投票 0

CSS 中子元素的高度问题

我遇到了 .contenedor-elementos-generales 的子元素高度问题 我不知道该怎么做才能修复它。 我的主要 html 文件: 我遇到了.contenedor-elementos-generales的子元素高度问题 我不知道该怎么做才能解决它。 我的主要 html 文件: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="https://fonts.googleapis.com/css2?family=Titillium+Web:wght@700&display=swap" rel="stylesheet"> <link rel="stylesheet" href="css/index.css"> <title>Descontrol</title> </head> <body> <div class="layout"> <div class="item-grilla contenedor-carta"> <img src="." alt="" id="imgCarta" class="img-carta"> <div class="contenedor-consola-carta"> <span class="consola-carta" id="textoConsolaCarta">Descripción carta: Lorem ipsum dolor sit, amet consectetur adipisicing elit. Reprehenderit obcaecati voluptatem eius quibusdam facilis dolores suscipit id a explicabo laborum.</span> </div> </div> <div class="item-grilla contenedor-consola-personaje"> <span class="consola-personaje" id="textoConsolaPersonaje">Consola: Lorem ipsum, dolor sit amet consectetur adipisicing elit. Voluptatum, vero nesciunt? Repellendus quos ipsam fugit?</span> </div> <div class="item-grilla contenedor-botones-juego"> <div class="boton-juego boton-levantarCarta" id="btnLevantarCarta"> <span>LEVANTAR CARTA</span> </div> <div class="boton-juego boton-atacar" id="btnAtacar"> <span>ATACAR</span> </div> </div> <div class="item-grilla encabezado-elementos-generales"> <div class="encabezado-personaje">AVATAR</div> <div class="encabezado-atributo">ATRIBUTO</div> <div class="encabezado-estado">ESTADO</div> </div> <div class="item-grilla contenedor-elementos-generales"> <div class="elemento-general contenedor-personaje"> <img src="img/vida.png" alt="" id="imgPersonaje" class="img-personaje"> </div> <div class="elemento-general contenedor-atributo"> <div class="atributo"> <img src="img/ataque.png" alt="" class="img-atributo"> <span class="text-atributo">0</span> </div> <div class="atributo"> <img src="img/esquiva.png" alt="" class="img-atributo"> <span class="text-atributo">0</span> </div> <div class="atributo"> <img src="img/velocidad.png" alt="" class="img-atributo"> <span class="text-atributo">0</span> </div> <div class="atributo"> <img src="img/vida.png" alt="" class="img-atributo"> <span class="text-atributo">0</span> </div> <div class="atributo"> <img src="img/vida.png" alt="" class="img-atributo"> <span class="text-atributo">0</span> </div> </div> <div class="elemento-general contenedor-estado"> <img src="img/vida.png" alt="" class="img-estado" id="imgEstado"> </div> </div> </div> <script src="js/main.js"></script> </body> </html> 我的CSS文件: * { all: initial; box-sizing: border-box; } * { border: 0; margin: 0; } body { font-size: 0.9rem; font-family: Titillium Web; } .layout { width: 100vw; height: 100vh; display: grid; grid-template-rows: repeat(18, 1fr); grid-template-columns: repeat(9, 1fr); outline: 1.5px solid #000; } .contenedor-carta { grid-column: 1/10; grid-row: 1/12; background: #000; display: flex; flex-direction: column; } .img-carta { height: calc((6/11)*100%); } .contenedor-consola-carta { height: calc((5/11)*100%); color: #fff; display: flex; justify-content: center; text-align: center; } .consola-carta { padding: 0 20px; padding-top: 50px; text-align: center; } .contenedor-consola-personaje { grid-column: 1/10; grid-row: 12/15; display: flex; align-items: center; justify-content: center; } .consola-personaje { text-align: center; padding: 30px; } .contenedor-botones-juego { grid-column: 1/10; grid-row: 15/16; display: flex; align-items: center; } .boton-juego { border-top: 1px solid #000; display: flex; justify-content: center; align-items: center; width: 50%; height: 100%; } .boton-juego.boton-levantarCarta { border-right: 1px solid #000; } .encabezado-elementos-generales { grid-column: 1/10; grid-row: 16/17; display: grid; grid-template-columns: repeat(9, 1fr); background: #000; color: #fff; } .encabezado-personaje, .encabezado-atributo, .encabezado-estado { display: flex; align-items: center; justify-content: center; text-align: center; } .encabezado-personaje { grid-column: 1/ span 2; } .encabezado-atributo { grid-column: 3 / span 5; } .encabezado-estado { grid-column: 8 / span 2; } .encabezado-elementos-generales * { text-align: center; } .contenedor-elementos-generales { grid-column: 1/10; grid-row: 17/-1; display: grid; grid-template-columns: repeat(9, 1fr); height: 100%; } .contenedor-personaje { grid-column: 1/3; background: #000; border: 1px solid #fff; } .contenedor-atributo { grid-column: 3/8; height: 100%; display: flex; flex-direction: row; align-items: stretch; background: #000; } .atributo { margin: 0 1px; overflow: hidden; display: flex; flex-direction: column; flex: 1; } .img-atributo { border: 1px solid #fff; height: 50%; background: #fff; } .text-atributo { margin-top: 2px; height: 50%; background: #fff; text-align: center; } .contenedor-estado { grid-column: 8/-1; background: #000; border: 1px solid #fff; } @media only screen and (min-width: 600px) { body { display: flex; justify-content: center; } .layout { width: 60vw; } } @media only screen and (min-width: 700px) { body { display: flex; justify-content: center; } .layout { width: 40vw; } } .layout元素被假设为一个9x18的网格,与任何窗口的尺寸相匹配,它做到了,问题是元素.contenedor-personaje、contenedor-atributo和.contenedor-estado的高度。 如果您发现其他错误或有建议,请随时告诉我,我仍然是网页设计的初学者。 导航器:Chrome 操作系统:Ubuntu 20.04 您似乎正在开发一个使用 CSS 网格来构建各个部分的布局。根据您的描述,问题与 .contenedor-elementos-generales 中的 .contenedor-personaje、.contenedor-atributo 和 .contenedor-estado 元素的高度有关。这些元素的高度在网格内可能不会按预期运行。 要解决这些元素的高度问题,您可以考虑进行一些修改: 调整网格行高:确保 .contenedor-elementos-generales 网格中的行具有正确的高度以容纳这些元素中的内容。 处理百分比高度:具有百分比高度的元素通常依赖其父元素的高度来计算自己的高度。确保所有父元素都有一个定义的高度,可以根据这些基于百分比的高度正确计算。 在您的情况下, .contenedor-elementos-generales 的指定高度为 100%,但其父级 .layout 没有固定高度。尝试为 .layout 设置固定高度或使用 100vh(视口高度)以确保网格内正确的百分比计算。 例如: .layout { /* existing styles */ height: 100vh; /* Set the layout height to be 100% of the viewport height */ } .contenedor-elementos-generales { /* existing styles */ height: calc(100% - [adjust for other elements' heights]); /* Adjust the height calculation as needed */ } 调整网格中的高度可能需要对百分比值进行一些试验,以完美地满足您的布局要求。另外,确保没有冲突的样式或填充/边距影响整体高度计算。 请记住在不同的视口大小上测试您的布局,以确保响应能力和一致的行为。

回答 1 投票 0

如何设置 HTML 元素的默认高度并让它调整为仅使用 CSS 的固定容器高度

假设我正在开发一个可重用的组件,呈现为 HTML 元素。任何人都可以在某个容器中渲染它。我事先不知道容器的样式:它可以有一个固定的

回答 1 投票 0

如何让不同列中的行在bootstrap中共享高度

我想知道是否可以让列位于不同的行中,以共享最大高度。我之所以采取这种做法是因为我还需要靴子的响应柱效果……

回答 1 投票 0

更改动态添加的ListBox的尺寸

我在 VBA 中创建了一个表单,在其中动态添加列表框。 如何更改列表框的宽度和高度?所有其他事情都在改变。 Dim lb As MSForms.ListBox 设置 lb = Me.con...

回答 2 投票 0

无法更改动态添加的列表框的尺寸

我已经找了好几个小时了,我希望有人能在这里帮助我。 我正在 vba 中创建一个表单,我想在其中动态添加列表框。列表框已添加,因此按计划进行。豪...

回答 2 投票 0

如何在 @react-spring useTransition 中将高度从 0 设置为“auto”?

我使用useTransition钩子为列表元素添加动画,其子元素的高度不是固定数字。如果我设置 {from:{height:0},enter:{height:'auto'},则元素会丢失动画。 我是...

回答 2 投票 0

调整跨域 Iframe 高度[重复]

我正在尝试将 iframe 高度参数更改为与 iframe 中加载的页面相同的 px。 iframe 中加载的页面来自另一个域。 不同的页面...

回答 5 投票 0

使用NETGeographicLib在RAWVAL方法中计算某点大地水准面高度时遇到问题

我正在开发一个类似于模拟的应用程序,它必须连续具有点(纬度,经度)的大地水准面高度。由于 NETGeographicLib 表现出高性能...

回答 1 投票 0

修复 100vh 菜单与 iPhone 顶部栏重叠的问题

我面临一个问题,绿色背景颜色出现在本应完全红色的菜单后面。菜单设计为填充全屏高度(100vh),但在 iPhone 上,顶部栏

回答 1 投票 0

根据 Android Compose 中的可用宽度/高度显示不同的内容(布局)

我有一个 Activity 和 MyApp 可组合函数。在该函数中,我需要显示带有详细信息的列表或仅显示列表屏幕,具体取决于可用宽度。如何确定...的可用宽度

回答 2 投票 0

具有从属 3 行的卡片(所有 3 行的高度相同)

我想创建一家商店,其中的商品分为 3 行。 1 行 - 标题 2行-图片 3 行 - 添加到购物车按钮/选择数量/有条件显示多个下拉菜单/

回答 1 投票 0

在 flex:1 容器内时,滚动在我的表单容器上不起作用

我有一个定义高度为 100vh 的容器,其中有一个具有固定高度的标题和一个带有 flex:1 的内容容器来填充其余高度。内容容器内...

回答 1 投票 0

如何在Flutter中为GridView中的Widget设置自定义高度?

即使指定了 Container GridView 的高度,我的代码也会生成方形小部件。 类 MyHomePage 扩展 StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); 菲...

回答 17 投票 0

我的图像不适合其容器的整个高度

我的 div 元素内有一个图像,我希望我的图像适合其容器的整个高度,但这不会发生。我的图像是正方形的。我不得不提的是我不关心asp...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.