CSS Grid Layout

This commit is contained in:
seiichiro 2022-01-10 21:27:57 +01:00
parent 24a6849f93
commit 3b6b96df6d
3 changed files with 196 additions and 156 deletions

View file

@ -1,127 +1,155 @@
/*
Very Simple Image Gallery
CSS Style Version 0.1
(C) seiichiro 2021
*/
/* General Style Settings */
body {
font-family: sans;
background-color: #000000;
font-family: sans;
padding: 0px;
margin: 0px;
box-sizing: border-box;
}
a:link {
text-decoration: none;
color: #c0c0c0;
}
a:visited {
text-decoration: none;
color: #c0c0c0;
}
a:hover {
text-decoration: none;
color: #c0c0c0;
}
a:active {
text-decoration: none;
color: #c0c0c0;
}
/* Page Header Styling */
.page-header {
padding: 10px;
padding: 8px;
margin: 0px 0px 10px 0px;
position: fixed;
top: 0;
left: 0;
right: 0;
background-color: #404040;
color: #c0c0c0;
margin-bottom: 10px;
display: grid;
grid-template-columns: 3fr 1fr;
align-items: center;
height: 3em;
}
.title {
.page-header .title {
font-size: 2em;
vertical-align: center;
padding-left: 8px;
}
.search {
justify-self: end;
/* Search Form Styling */
.page-header .search {
justify-self: right;
}
.images {
padding: 4px;
position: relative;
}
.single {
height: 92vh;
}
.single-image {
position: absolute;
}
.multi-image {
.page-header .search form input[type=text] {
padding: 10px;
font-size: 1em;
border: 1px solid grey;
float: left;
padding: 6px;
width: 70%;
background: #f1f1f1;
}
.page-header .search form button {
float: left;
width: 15%;
padding: 10px;
background: #2196F3;
color: white;
font-size: 1em;
border: 1px solid grey;
border-left: none;
cursor: pointer;
}
.page-header .search form button:hover {
background: #0b7dda;
}
.page-header .search form::after {
content: "";
clear: both;
display: table;
}
/* Gallery Styling */
.content {
padding-top: 4em;
padding-bottom: 4em;
margin: 16px;
display: grid;
gap: 12px;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
grid-template-rows: repeat(auto-fit, minmax(200px, 1fr));
}
.content .multi-image {
margin: 4px;
padding: 0px;
width: 200px;
height: 200px;
}
.clickable {
display: block;
width: 39%;
height: 80%;
position: relative;
z-index: 9;
opacity: 0;
background-color: #000000;
float: left;
}
.clickable-center {
width: 20%;
height: 50%;
margin-left: 1%;
margin-right: 1%;
float: center;
}
.clickable-right {
float: right;
height: 80%;
}
.single-image img {
object-fit: contain;
width: 98vw;
height: 92vh;
background-color: greenyellow;
}
.multi-image img {
.content .multi-image img {
object-fit: contain;
width: 200px;
height: 200px;
}
.footer {
padding: 10px;
margin-top: 10px;
background-color: #404040;
color: #c0c0c0;
display: block;
clear: both;
text-align: center;
/* Single Image Styling */
.content-single {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 4em;
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(2, 1fr);
}
.footer a {
margin-left: 0.5em;
margin-right: 0.5em;
font-size: 3em;
font-weight: bold;
color: #ffffff;
.content-single .single-image {
grid-column: 1 / 4;
grid-row: 1 / 3;
background-color: chartreuse;
}
.footer .info {
margin-left: 0.5em;
margin-right: 0.5em;
font-size: 3em;
font-weight: bold;
color: #ffffff;
.content-single .single-image img {
object-fit: contain;
grid-column: 1 / 4;
grid-row: 1 / 3;
}
.footer .tag {
margin-left: 0.5em;
margin-right: 0.5em;
font-size: 0.4em !important;
font-weight: normal !important;
color: #00ff00;
/* Clickable Areas in Single Image View */
.content-single .clickable {
z-index: 9;
opacity: 0;
}
.content-single .clickable-left {
grid-column: 1 / 2;
grid-row: 1 / 3;
}
.content-single .clickable-center {
grid-column: 2 / 3;
grid-row: 1 / 2;
}
.content-single .clickable-right {
grid-column: 3 / 4;
grid-row: 1 / 3;
}
/* Error Page */
.error {
margin-left: 0.5em;
margin-right: 0.5em;
@ -130,36 +158,47 @@ a:active {
color: #ffffff;
}
/* Style the search field */
form.f-search input[type=text] {
padding: 10px;
font-size: 17px;
border: 1px solid grey;
float: left;
width: 70%;
background: #f1f1f1;
/* Page Footer Styling */
.page-footer {
padding: 8px;
margin: 10px 0px 0px 0px;
background-color: #404040;
color: #c0c0c0;
position: fixed;
width: 100%;
bottom: 0;
left: 0;
right: 0;
height: 3em;
text-align: center;
overflow: auto;
}
/* Style the submit button */
form.f-search button {
float: left;
width: 15%;
padding: 10px;
background: #2196F3;
color: white;
font-size: 17px;
border: 1px solid grey;
border-left: none; /* Prevent double borders */
cursor: pointer;
.page-footer a {
margin-left: 0.5em;
margin-right: 0.5em;
font-size: 2em;
font-weight: bold;
color: #ffffff;
text-decoration: none;
}
form.f-search button:hover {
background: #0b7dda;
.page-footer .info {
margin-left: 0.5em;
margin-right: 0.5em;
font-size: 2em;
font-weight: bold;
color: #ffffff;
}
/* Clear floats */
form.f-search::after {
content: "";
clear: both;
display: table;
}
.page-footer .tag {
margin-left: 0.5em;
margin-right: 0.5em;
font-size: 0.5em !important;
font-weight: normal !important;
color: #00ff00;
}

View file

@ -3,33 +3,33 @@
{% block title %}Gallery{% endblock %}
{% block content %}
<div class="content">
<div class="page-header">
<div class="title"><a href="{{ $startpage }}">{{ $galleryname }}</a></div>
<div class="search">
<form class="f-search" action="index.php" method="get">
<input type="text"placeholder="Suche.." name="f" />
<button type="submit"><i class="fa fa-search"></i></button>
<input type="hidden" name="d" value="{{ $dir }}">
<input type="hidden" name="s" value="{{ $slice }}">
</form>
<div class="container">
<div class="page-header">
<div class="title"><a href="{{ $startpage }}">{{ $galleryname }}</a></div>
<div class="search">
<form action="index.php" method="get">
<input type="text"placeholder="Suche.." name="f" />
<button type="submit"><i class="fa fa-search"></i></button>
<input type="hidden" name="d" value="{{ $dir }}">
<input type="hidden" name="s" value="{{ $slice }}">
</form>
</div>
</div>
</div>
<div class="images">
{% foreach($images as $image): %}
<div class="multi-image">
<a href="index.php?d={{ $dir }}&s=1&gs={{ $slice }}&p={{ $image['i'] }}{{ $filter }}">
<img src="{{ $image['t'] }}" alt="{{ $image['n'] }}"/>
</a>
</div>
{% endforeach %}
</div>
<div class="footer page-footer">
<div class="content">
{% foreach($images as $image): %}
<div class="multi-image">
<a href="index.php?d={{ $dir }}&s=1&gs={{ $slice }}&p={{ $image['i'] }}{{ $filter }}">
<img src="{{ $image['t'] }}" alt="{{ $image['n'] }}"/>
</a>
</div>
{% endforeach %}
</div>
<div class="page-footer">
<a id="link-first" href="/index.php?d={{ $dir }}&p=1&s={{ $slice }}{{ $filter }}">1</a>
<a id="link-prev" href="/index.php?d={{ $dir }}&p={{ $prev_page }}&s={{ $slice }}{{ $filter }}"><i class="fa fa-caret-left"></i></a>
<span class="info">{{ $page }}</span>
<a id="link-next" href="/index.php?d={{ $dir }}&p={{ $next_page }}&s={{ $slice }}{{ $filter }}"><i class="fa fa-caret-right"></i></a>
<a id="link-last" href="/index.php?d={{ $dir }}&p={{ $last_page }}&s={{ $slice }}{{ $filter }}">{{ $last_page }}</a>
</div>
</div>
</div>
{% endblock %}

View file

@ -4,24 +4,25 @@
{% block content %}
<div class="content single">
<div class="single-image">
<img src="{{ $imageurl }}" title="{{ $page }}/{{ $last_page }}" />
<div class="container">
<div class="content-single">
<div class="single-image">
<img src="{{ $imageurl }}" title="{{ $page }}/{{ $last_page }}" />
</div>
<a id="link-prev" href="/index.php?d={{ $dir }}&p={{ $prev_page }}&s=1&gs={{ $gallery_slice }}{{ $filter }}">
<div class="clickable clickable-left"></div>
</a>
<a id="link-home" href="/index.php?d={{ $dir }}&p={{ $gallery_page }}&s={{ $gallery_slice }}{{ $filter }}">
<div class="clickable clickable-center"></div>
</a>
<a id="link-next" href="/index.php?d={{ $dir }}&p={{ $next_page }}&s=1&gs={{ $gallery_slice }}{{ $filter }}">
<div class="clickable clickable-right"></div>
</a>
</div>
<div class="page-footer">
{% foreach($tags as $tag): %}
<a href="/index.php?d={{ $dir }}&s={{ $gallery_slice }}&f={{{ $tag }}}"><span class="tag">{{ $tag }}</span></a>
{% endforeach %}
</div>
<a id="link-prev" href="/index.php?d={{ $dir }}&p={{ $prev_page }}&s=1&gs={{ $gallery_slice }}{{ $filter }}">
<div class="clickable"></div>
</a>
<a id="link-home" href="/index.php?d={{ $dir }}&p={{ $gallery_page }}&s={{ $gallery_slice }}{{ $filter }}">
<div class="clickable clickable-center"></div>
</a>
<a id="link-next" href="/index.php?d={{ $dir }}&p={{ $next_page }}&s=1&gs={{ $gallery_slice }}{{ $filter }}">
<div class="clickable clickable-right"></div>
</a>
</div>
<div class="footer">
{% foreach($tags as $tag): %}
<a href="/index.php?d={{ $dir }}&s={{ $gallery_slice }}&f={{{ $tag }}}"><span class="tag">{{ $tag }}</span></a>
{% endforeach %}
</div>
{% endblock %}