Dkngit's notebook

day by day ...

首页 关于

分类 CSS 下的文章

[copy]height-equal-to-dynamic-width-css-fluid-layout | 使元素高度等于动态宽度

  • 作者: Dkngit
  • 时间: 2022-06-07
  • 分类: CSS
  • 评论

There is a way using CSS!

If you set your width depending on the parent container you can set the height to 0 and set padding-bottom to the percentage which will be calculated depending on the current width:

.some_element {
    position: relative;
    width: 20%;
    height: 0;
    padding-bottom: 20%;
}

This works well in all major browsers.

https://stackoverflow.com/questions/5445491/height-equal-to-dynamic-width-css-fluid-layout

最新文章

  • Linux 命令
  • ssh 端口转发
  • Windows kms
  • Windows 命令
  • mv or cp with multiple files
  • How to Use APT with Proxy on Ubuntu and Debian
  • apt upgrade vs dist-upgrade
  • Debian 12/Bookworm (stable) Example sources.list
  • [copy] @ManyToOne(optional=false) 与 @Column(nullable=false) 的区别
  • [copy]Convert Date to LocalDate or LocalDateTime and Back

最近回复

标签

  • 副本

分类

  • 默认分类
  • typecho
  • Code
    • Python
    • Java
      • Java-MongoDB
      • Spring
        • SpringBoot
      • Gradle
      • Hibernate
    • Git
    • Docker
    • Javascript
      • Node.js
      • jQuery
    • Oracle Database
    • CSS
    • HTML
  • Linux
    • CentOS
    • Debian
  • 杂记
  • Windows

归档

  • November 2023
  • October 2023
  • August 2023
  • July 2023
  • December 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • December 2021
  • November 2021
  • September 2021
  • August 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021

其它

  • 登录
  • 文章 RSS
  • 评论 RSS
  • Typecho
© 2023 Dkngit's notebook. 由 Typecho 强力驱动.