Skip to content

Commit f116605

Browse files
committed
drop flexbox and use media query to implement responsive screenshot banner
1 parent 439d072 commit f116605

File tree

2 files changed

+73
-33
lines changed

2 files changed

+73
-33
lines changed

doc/_static/mpl.css

Lines changed: 60 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -683,20 +683,64 @@ figcaption {
683683
outline-color: #003c63;
684684
}
685685

686-
.flex-container {
687-
/* display part copy-pasted from: https://css-tricks.com/using-flexbox/ */
688-
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
689-
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
690-
display: -ms-flexbox; /* TWEENER - IE 10 */
691-
display: -webkit-flex; /* NEW - Chrome */
692-
display: flex; /* NEW, Spec - Opera 12.1, Firefox 20+ */
693-
694-
flex-wrap: wrap;
695-
flex-direction: row;
696-
align-content: center;
697-
justify-content: center;
698-
}
699-
700-
.flex-item {
701-
margin: 0px;
686+
687+
div.responsive_banner {
688+
/* Horizontally centered */
689+
display: block;
690+
margin: auto;
691+
692+
max-height: 139px; /* at most 1 x 1:1 subfig height */
693+
width=100%;
694+
overflow: auto; /* to follow the height of the subfig floats */
695+
}
696+
697+
div.responsive_screenshots {
698+
/* Horizontally centered */
699+
display: block;
700+
margin: auto;
701+
702+
/* Do not go beyond 1:1 scale*/
703+
max-width: 648px; /* 4 * 1:1 subfig width */
704+
max-height: 139px; /* 1 * 1:1 subfig height */
705+
706+
/* Possible downscaling */
707+
width=auto;
708+
height: 100%;
709+
}
710+
711+
div.responsive_subfig{
712+
float: left;
713+
width: 25%; /* 4 subfigs in a row */
714+
}
715+
716+
div.responsive_subfig img {
717+
/* Horizontally centered */
718+
display: block;
719+
margin: auto;
720+
721+
/* Possible downscaling */
722+
max-width: 162px; /* 1 * 1:1 subfig width */
723+
max-height: 139px; /* 1 * 1:1 subfig height */
724+
width: 100%;
725+
height: auto;
726+
}
727+
728+
@media only screen and (max-width: 1024px){
729+
/* The value of 1024px was handcrafted to provide a more or less */
730+
/* smooth transition between the 1x4 and the 2x2 layouts. */
731+
732+
div.responsive_banner {
733+
max-height: 278px; /* at most 2 x 1:1 subfig height */
734+
}
735+
736+
div.responsive_screenshots {
737+
/* Do not go beyond 1:1 scale*/
738+
max-width: 324px; /* 2 x 1:1 subbfig width */
739+
max-height: 139px; /* 1 x 1:1 subfig height */
740+
}
741+
742+
div.responsive_subfig {
743+
width: 50%; /* 2 subfigs in a row */
744+
}
745+
702746
}

doc/_templates/index.html

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,28 +58,24 @@ <h1>Introduction</h1>
5858
interface toolkits.</p>
5959

6060
<p align="center">
61-
<div class="flex-container">
62-
<div class="flex-item">
63-
<a a href="{{ pathto('users/screenshots') }}">
61+
<div class="responsive_banner">
62+
<div class="responsive_screenshots">
63+
<a a href="{{ pathto('users/screenshots') }}">
64+
<div class="responsive_subfig">
6465
<img align="middle", src="{{ pathto('_static/membrane_frontpage.png', 1) }}", border="0", alt="screenshots"/>
65-
</a>
66-
</div>
67-
<div class="flex-item">
68-
<a a href="{{ pathto('users/screenshots') }}">
66+
</div>
67+
<div class="responsive_subfig">
6968
<img align="middle", src="{{ pathto('_static/histogram_frontpage.png', 1) }}", border="0", alt="screenshots"/>
70-
</a>
71-
</div>
72-
<div class="flex-item">
73-
<a a href="{{ pathto('users/screenshots') }}">
69+
</div>
70+
<div class="responsive_subfig">
7471
<img align="middle", src="{{ pathto('_static/contour_frontpage.png', 1) }}", border="0", alt="screenshots"/>
75-
</a>
76-
</div>
77-
<div class="flex-item">
78-
<a a href="{{ pathto('users/screenshots') }}">
72+
</div>
73+
<div class="responsive_subfig">
7974
<img align="middle", src="{{ pathto('_static/surface3d_frontpage.png', 1) }}", border="0", alt="screenshots"/>
80-
</a>
81-
</div>
75+
</div>
76+
</a>
8277
</div>
78+
</div>
8379
</p>
8480

8581
<p>matplotlib tries to make easy things easy and hard things possible.

0 commit comments

Comments
 (0)