如何填充<a>标记以填充容器中的父div

分裂细胞9

我开始了一个新的电子项目(Angulat 9:使用scss),目前停留在制作自定义标题栏上。这是我的代码:

app.component.html

<div class="container">
  <app-titlebar></app-titlebar>

  <div id="router_outlet">
    <router-outlet></router-outlet>
  </div>
</div>

titlebar.component.html

html, body{
  margin: 0 ;
  padding: 0 ;
  width: 100% ;
  height: 100% ;
}



.titlebar {
  display: flex;
  position: relative;
  border: 1px solid black ; /* for reference*/
  top: 0;
  left: 0;
  justify-content: space-between;
  height: 3rem;
  flex-direction: row;
}

.window-button,
.back-button {
  font-size: 12pt;
  font-weight: lighter;
  -webkit-app-region: no-drag;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.window-button {
  padding-left: 15px;
  padding-right: 15px;
}

.back-button {
  padding-left: 17px;
  padding-right: 17px;
}

#restore {
  transform: rotate(180deg);
}

.window,
.navigation {
  display: flex;
  align-items: center;
}

.normal:hover {
  background-color: rgba(0,0,0,0.2);
}

.danger:hover {
  background-color: red;
  color: white;
}
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<div class="titlebar">
  <div class="navigation">
    <a class="back-button normal material-icons">arrow_back</a>
    <span class="apptitle">Electron-App</span>
  </div>
  <div class="window">
    <a class="window-button normal material-icons">remove</a>
    <a *ngIf="showMaximizeButton ; else showRestore" class="window-button normal material-icons">crop_square</a>
    <!-- <ng-template #showRestore>
      <a class="window-button normal material-icons" id="restore">flip_to_front</a>
    </ng-template> -->
    <a class="window-button danger material-icons">clear</a>
  </div>
</div>

我的问题是如何将这些<a>标记完全填充到其父div元素的高度,以便将鼠标悬停在这些链接上时,背景区域就会完全填充到该.titlebar高度。

卢卡斯·弗林特(Lucas Flint)

将其高度设置为全高,并使其也弯曲以允许其内容的垂直定位(它们已经设置为inline-block

html, body{
  margin: 0 ;
  padding: 0 ;
  width: 100% ;
  height: 100% ;
}

.titlebar {
  display: flex;
  position: relative;
  border: 1px solid black ; /* for reference*/
  top: 0;
  left: 0;
  justify-content: space-between;
  height: 3rem;
  flex-direction: row;
}

.window-button,
.back-button {
  font-size: 12pt;
  font-weight: lighter;
  -webkit-app-region: no-drag;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  height: 100%;
  display: inline-flex !important;
  align-items: center;
}

.window-button {
  padding-left: 15px;
  padding-right: 15px;
}

.back-button {
  padding-left: 17px;
  padding-right: 17px;
}

#restore {
  transform: rotate(180deg);
}

.window,
.navigation {
  display: flex;
  align-items: center;
}

.normal:hover {
  background-color: rgba(0,0,0,0.2);
}

.danger:hover {
  background-color: red;
  color: white;
}
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<div class="titlebar">
  <div class="navigation">
    <a class="back-button normal material-icons">arrow_back</a>
    <span class="apptitle">Electron-App</span>
  </div>
  <div class="window">
    <a class="window-button normal material-icons">remove</a>
    <a *ngIf="showMaximizeButton ; else showRestore" class="window-button normal material-icons">crop_square</a>
    <!-- <ng-template #showRestore>
      <a class="window-button normal material-icons" id="restore">flip_to_front</a>
    </ng-template> -->
    <a class="window-button danger material-icons">clear</a>
  </div>
</div>

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

如何使3 divs填充父容器的高度

来自分类Dev

如何使3 divs填充父容器的高度

来自分类Dev

如何使 Bootstrap 行填充父容器的高度?

来自分类Dev

在父容器引导程序中填充图像

来自分类Dev

如何使控件填充WPF中的容器?

来自分类Dev

使div填充父级中的空白

来自分类Dev

如何拉伸ListView项的宽度以填充父容器?

来自分类Dev

如何拉伸ListView项的宽度以填充父容器?

来自分类Dev

如何扩展父 Div 高度以填充它包含的父

来自分类Dev

如何使图像填充其父容器?

来自分类Dev

如何在父div内对齐div并填充它

来自分类Dev

如何用表单中的值填充div?

来自分类Dev

如何将子div放入父类的填充内?

来自分类Dev

使<div>标签填充父<td>

来自分类Dev

使<div>标签填充父<td>

来自分类Dev

Bootstrap Div 填充父高度

来自分类Dev

如何使div填充剩余空间?

来自分类Dev

角材料:布局容器以填充父级

来自分类Dev

使<li>元素展开以填充父容器

来自分类Dev

Extjs子项未填充父容器

来自分类Dev

网格列未填充父容器

来自分类Dev

角材料:布局容器以填充父级

来自分类Dev

填充父容器后,RecyclerView滚动

来自分类Dev

如何在VBscript中创建带有填充零的标记

来自分类Dev

如何从Seaborn 0.11+中获取没有填充的标记

来自分类Dev

如何在Bootstrap 3中创建一个无需填充即可填充整个屏幕的容器?

来自分类Dev

如何在Susy 2.0中向容器添加左右填充

来自分类Dev

如何从字典中填充StructuredProperty?

来自分类Dev

如何删除页面中的填充?