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

View file

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

View file

@ -4,24 +4,25 @@
{% block content %} {% block content %}
<div class="content single"> <div class="container">
<div class="single-image"> <div class="content-single">
<img src="{{ $imageurl }}" title="{{ $page }}/{{ $last_page }}" /> <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> </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>
<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 %} {% endblock %}