Skip to content

Commit 9d85d2b

Browse files
committed
fix gasp between backgrounds of body and sidebar divs
The issue is the linear-gradient in the body background seems to not working really correctly with pixel dimensions (in Firefox at least): if you zoom in / out the page you'll see the body background to not always correctly update the rendering (and so you'll see a growing gasp for example). Due to this issue, there was a gap between the backgrounds of the body and the sidebar elements. PR linuxfrorg#354 tried to solve this by adjusting the linear-gradient pixel dimensions, but due to the bug of linear-gradient implementation, it was not working when window was resized or page zoomed. As the linear-gradient usage in the body background was clearly already a workaround to create two vertical color stripes, we replace it with another workaround using the CSS feature which allows to define multiple background images with different size and position. First background image is defined with the sidebar color (using linear-gradient with only one color) and the width which resolve the pixel gasp reported in linuxfrorg#354 (which means the width should be the branding width + body border width). To be able to define a color as an image, we use again linear-gradient, but, this time it fills all the stripe with the same color, so we won't have error due to linear-gradient implementation. Second image is defined from the first image position for the rest of the body block with the container color. This new workaround idea comes from this StackOverflow answer which explain how to create pixel perfect horizontal stripes: https://stackoverflow.com/a/24829344
1 parent c7ef92a commit 9d85d2b

File tree

5 files changed

+15
-23
lines changed

5 files changed

+15
-23
lines changed

app/assets/stylesheets/RonRonnement.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ $PX_MARGE_GAUCHE: 42px;
99
$PX_MARGE_DROITE: 30px;
1010
$PX_BANDEAU: 7px;
1111
$PX_BRANDING_LARG: 201px;
12+
$PX_BODY_BORDER_WIDTH_LEFT_RIGHT: 1px;
1213
$PX_SITE_PAD_DROIT: 42px;
1314
$PX_CONT_TOP: 34px;
1415

app/assets/stylesheets/contrib/RonRonnement-Classic.scss

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ $PX_MARGE_GAUCHE: 42px;
4040
$PX_MARGE_DROITE: 30px;
4141
$PX_BANDEAU: 7px;
4242
$PX_BRANDING_LARG: 201px;
43+
$PX_BODY_BORDER_WIDTH_LEFT_RIGHT: 1px;
4344
$PX_SITE_PAD_DROIT: 42px;
4445
$PX_CONT_TOP: 34px;
4546

@@ -88,15 +89,11 @@ body {
8889
max-width: 150ex;
8990
margin: 0 auto;
9091
border: solid $C_BORDER_FONCE;
91-
border-width: 0 1px;
92-
background: linear-gradient(
93-
90deg,
94-
$C_CLAIR,
95-
$C_CLAIR $PX_BRANDING_LARG,
96-
$C_CONTAINER $PX_BRANDING_LARG,
97-
$C_CONTAINER
98-
)
99-
#fff;
92+
border-width: 0 $PX_BODY_BORDER_WIDTH_LEFT_RIGHT;
93+
background-repeat: no-repeat;
94+
background-size: $PX_BRANDING_LARG + $PX_BODY_BORDER_WIDTH_LEFT_RIGHT, auto;
95+
background-position: 0, $PX_BRANDING_LARG + $PX_BODY_BORDER_WIDTH_LEFT_RIGHT;
96+
background-image: linear-gradient($C_CLAIR, $C_CLAIR), linear-gradient($C_CONTAINER, $C_CONTAINER);
10097
}
10198

10299
a {
@@ -360,7 +357,6 @@ a.edit_client_app,
360357
width: $PX_BRANDING_LARG;
361358
text-align: left;
362359
font-size: 0.8em;
363-
background: $C_CLAIR;
364360

365361
a {
366362
font-weight: inherit;

app/assets/stylesheets/contrib/RonRonnement-Sepia.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ $PX_MARGE_DROITE: 30px;
3636
$PX_TOP: 16px;
3737
$PX_BANDEAU: 7px;
3838
$PX_BRANDING_LARG: 201px;
39+
$PX_BODY_BORDER_WIDTH_LEFT_RIGHT: 1px;
3940
$PX_BRANDING_HEIGHT: 186px;
4041
$PX_SITE_PAD_DROIT: 42px;
4142
$PX_CONT_TOP: 34px;
@@ -85,8 +86,8 @@ body {
8586
margin-top: 0;
8687
margin-bottom: 0;
8788
padding-top: $PX_TOP;
88-
border-left: 1px #333 solid;
89-
border-right: 1px #333 solid;
89+
border-left: $PX_BODY_BORDER_WIDTH_LEFT_RIGHT #333 solid;
90+
border-right: $PX_BODY_BORDER_WIDTH_LEFT_RIGHT #333 solid;
9091
background: #fff;
9192
}
9293

@@ -285,7 +286,6 @@ input[type="submit"] {
285286
width: $PX_BRANDING_LARG;
286287
text-align: left;
287288
font-size: small;
288-
background: $C_CLAIR;
289289

290290
a {
291291
font-weight: inherit;

app/assets/stylesheets/parts/a_tag.scss

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,11 @@ body {
2121
max-width: $BODY_MAX_WIDTH;
2222
margin: 0 auto;
2323
border: solid #999;
24-
border-width: 0 1px;
25-
background: linear-gradient(
26-
90deg,
27-
$C_CLAIR,
28-
$C_CLAIR $PX_BRANDING_LARG,
29-
$C_CONTAINER $PX_BRANDING_LARG,
30-
$C_CONTAINER
31-
)
32-
#fff;
24+
border-width: 0 $PX_BODY_BORDER_WIDTH_LEFT_RIGHT;
25+
background-repeat: no-repeat;
26+
background-size: $PX_BRANDING_LARG + $PX_BODY_BORDER_WIDTH_LEFT_RIGHT, auto;
27+
background-position: 0, $PX_BRANDING_LARG + $PX_BODY_BORDER_WIDTH_LEFT_RIGHT;
28+
background-image: linear-gradient($C_CLAIR, $C_CLAIR), linear-gradient($C_CONTAINER, $C_CONTAINER);
3329
}
3430

3531
a {

app/assets/stylesheets/parts/sidebar.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
text-align: left;
55
font-size: 0.8em;
66
line-height: 1.3;
7-
background: $C_CLAIR;
87

98
a {
109
font-weight: inherit;

0 commit comments

Comments
 (0)