gpt4 book ai didi

在 Firefox 上,CSS 外观在页面刷新之间发生变化

转载 作者:太空宇宙 更新时间:2023-11-04 10:34:12 25 4
gpt4 key购买 nike

下午好

我有一小段 CSS 可以构建一个装饰性的“丝带”来保存博客文章的日期。有时效果很好。

在刷新之间,我在 CSS 中设置的边距和定位似乎偶尔会被跳过。

在同一 Firefox 浏览器窗口中点击“刷新”按钮时会发生这种情况。似乎是随机的,无论是使用 shift-reload 还是 regular。

picture to show working/broken appearance

body {
padding-left: 1em;
padding-right: 1em;

color: #cfcfcf;
background-color: #3b85a9;

margin: auto;
font-family: sans-serif; }

.ribbon1 {display:inline-block;width:100%;}

.ribbon2 {
/* */
/* original from Ian Yates - http://tutsplus.com/authors/ian-yates */
/* */

position: relative;
float: left;
clear: left;

display:block;
height: 60px; /* width of the ribbon */
width:25px; /* length of the ribbon */

margin-right: 150px;
margin-bottom: 10px;
margin-left: -25px;
margin-top: 1px;

background-color: #c94700; }

.ribbon2:after { /* builds the folded edge */
content: "";
display: block;
width: 25px;
height: 0px;

position: absolute;
right: 0;
bottom: -1px;
z-index: 4;

border-bottom: 60px solid #de6625;
border-right: 60px solid transparent;

-webkit-transform: rotate(90deg);
-webkit-transform-origin: right bottom;
-moz-transform: rotate(90deg);
-moz-transform-origin: right bottom;
-o-transform: rotate(90deg);
-o-transform-origin: right bottom;
-ms-transform: rotate(90deg);
-ms-transform-origin: right bottom;
transform: rotate(90deg);
transform-origin: right bottom; }

.ribbon2:before { /* the shadow effect for the folded edge */
content: "";
display: block;
width: 15px;
height: 0px;

position: absolute;
right: 0;
bottom: 0px;
z-index: 3;

border-bottom: 60px solid rgba(0, 0, 0, 0.3);
border-right: 60px solid transparent;

-webkit-transform: rotate(85deg);
-webkit-transform-origin: right bottom;
-moz-transform: rotate(85deg);
-moz-transform-origin: right bottom;
-o-transform: rotate(85deg);
-o-transform-origin: right bottom;
-ms-transform: rotate(85deg);
-ms-transform-origin: right bottom;
transform: rotate(85deg);
transform-origin: right bottom; }


.blog_year {
position: absolute;
top:4;
left:6;
width: 0;

word-wrap: break-word;
color: white;
font-size: 0.85em;
line-height: 0.95em; }

.blog_month {
position: absolute;
top:-20;
left:24;
width: 60px;
z-index: 5;

text-align: center;
color: white;
font-size: 0.85em;
line-height: 1em; }

.blog_day {
position: absolute;
top:-5;
left:24;
width: 60px;
z-index: 5;

text-align: center;
color: white;
font-weight: bold;
font-size: 2em;
line-height: 1em;
text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3); }

.blog_title {
width: 700px;
margin-left: 80px;
margin-top: 5;
clear:right;

text-align: left;
font-size: 2.5em;
line-height: 1.5em;
font-weight: bold;
text-shadow: -2px 2px 0 rgba(0, 0, 0, 0.25); }
<body>

<div id="container"
style="width:500px; margin:50px; padding:10px; background:#444;">

<div class="ribbon1">
<div class="ribbon2">
<span class="blog_year"> 2016 </span>
<span class="blog_month"> march </span>
<span class="blog_day"> 15 </span>
<div class="blog_title"> Here's your words. </div>
</div> <!-- div "ribbon2" -->
</div> <!-- div "ribbon1" -->

</div>

</body>

我在这里看到其他线程也有类似的问题,建议是有一个 CSS 的 chached 版本。不幸的是,即使在第一次查看测试页面时,CSS 定位显然也被忽略了,直到我点击“刷新”。所以这不可能是缓存问题。

任何建议都很好 :)

最佳答案

不知道为什么刷新后对你有用。对我来说,它只有在我修复 css 并添加缺少的 px 单位时才有效:

.blog_year {
top:4px;
left:6px;
}
.blog_month {
top:-20px;
left:24px;
}
.blog_day {
top:-5px;
left:24px;
}
.blog_title {
margin-top: 5px;
}

关于在 Firefox 上,CSS 外观在页面刷新之间发生变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36277515/

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