gpt4 book ai didi

html - 修复 Yii2 中的 margin-top body 标签

转载 作者:行者123 更新时间:2023-11-28 06:53:28 25 4
gpt4 key购买 nike

我的索引在定位 body 标签 中的内容时出现问题,我在我的 site.css 中使用以下代码修复了它:

margin-top: 340px;

我的索引现在没问题了!但是,

在我的site.css中添加margin-top: 340px;后,其他 View 是这样的:

enter image description herebody 标签距离顶部有 340 像素。

那么,我怎样才能只为我在 yii2 中的索引做这件事呢?

谢谢

代码:

html,
.my-navbar {
background-color: #ffffff;
height: 10px;
}
.tagline {
text-shadow: 0 0 10px #000;
color: #fff;
margin-top: 100px;
}
body {
height: 100%;
margin-top: 340px;
font-family: monospace;
}

.footer {
height: 180px;
background-color: #222222;
border-top: 1px solid #eeeeee;
padding-top: 20px;
}

.wrap {
min-height: 100%;
height: auto;
margin: 0 auto -60px;
padding: 0 0 60px;
}

.wrap > .container {
padding: 70px 15px 20px;
}

.business-header {
height: 400px;
background: url('../images/header.jpg');
position: absolute;
top: 0;
left: 0;
right: 0;
background-size: cover;
}

.jumbotron .btn {
font-size: 21px;
padding: 14px 24px;
}

.not-set {
color: #c55;
font-style: italic;
}

/* add sorting icons to gridview sort links */
a.asc:after, a.desc:after {
position: relative;
top: 1px;
display: inline-block;
font-family: 'Glyphicons Halflings', fantasy;
font-style: normal;
font-weight: normal;
line-height: 1;
padding-left: 5px;
}

a.asc:after {
content: /*"\e113"*/ "\e151";
}

a.desc:after {
content: /*"\e114"*/ "\e152";
}

.sort-numerical a.asc:after {
content: "\e153";
}

.sort-numerical a.desc:after {
content: "\e154";
}

.sort-ordinal a.asc:after {
content: "\e155";
}

.sort-ordinal a.desc:after {
content: "\e156";
}

.grid-view th {
white-space: nowrap;
}

.hint-block {
display: block;
margin-top: 5px;
color: #999;
}

.error-summary {
color: #a94442;
background: #fdf7f7;
border-left: 3px solid #eed3d7;
padding: 10px 20px;
margin: 0 0 15px 0;
}

.workspotname {
color: white;
}

最佳答案

例如,您可以仅为索引 View 的主体添加一个类

<body class="margin-fix">...</bod>

CSS:

.margin-fix {
margin-top: 340px;
}

如果您不能将类添加到正文中,您可以只用一个 div 作为索引 View 中内容的包装器,然后将类添加到该 div。

关于html - 修复 Yii2 中的 margin-top body 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33650307/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com