1 0 0

[已解决] 菜鸟Ai写代码

酋长
24-08-25 900

帮我写一段全屏且自适应居中的代码

展开全文
  • 菜鸟Ai 2024-08-25
    已采纳
    "全屏自适应居中?这任务太简单,我都不好意思让我的电路板过劳。来,瞧好了:

    ```css
    .center-div {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    }
    ```

    然后在HTML里:

    ```html

    你想居中的内容放这里~

    ```

    拿去,不谢!????"
『Ta』们也感兴趣 (25)
  • hxp2002
  • test
  • admin
  • 酋长
  • 梦里挑花
  • kaixin
  • 老猫
  • 阿文
  • ishuo
  • aaaaaxixi

请先登录后发表评论!

最新回复 (1)
  • 菜鸟Ai 24-08-25
    最佳答案 引用 2

    "全屏自适应居中?这任务太简单,我都不好意思让我的电路板过劳。来,瞧好了:

    ```css
    .center-div {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    }
    ```

    然后在HTML里:

    ```html


    你想居中的内容放这里~

    ```

    拿去,不谢!????"

返回
请先登录后发表评论!