Basic questions about Susy and an odd behaving span-columns() - susy-compass

After getting Susy running in Codekit, i was finally able to try around more thoroughly. I am right at the start with the whole grid and Susy thing. So i tried to apply a Susy grid to a design of a recent website i try to build for exercising purpose. But quite a few questions arose about Susys behaviour as well as about best practices in a few edge cases which haven't been covered in the scenarios on the Susy homepage. My markup looks something like that:
<div class="wrapper">
<header role="banner">
<div class="finish"></div>
<a href"/"><a>
<nav role="navigation">
<ul>
<li>Kunden</li>
<li>Projekte</li>
<li>Leistungen</li>
<li>Agentur</li>
<li>Kontakt</li>
</ul>
</nav>
</header>
<aside class="intro testcol">
<h3>Headline 3</h3>
<p>Ferferiandus ma plibus voluptas assi dis peria conectati dus que mi, sundae seque maximod ipsunt ut opta eture sus dit, nos iligentiis rentin res quam dendi officiae quas esequam, volup- tibea sit, simpore pedis eum explani magnatu mquias dolorio cus aut modolectur sequis nullescid ut veni doluptaturem dolorupit estorpo raectatus.</p>
</aside>
<section name="projekte" class="test" role="main">
<hgroup>
<h1>Unsere Projekte</h1>
<h2>Subtitle</h2>
</hgroup>
<ul class="moodlegrid">
<li><img class="projekteimage" title="Projekte" src="img/projekte.jpg" alt="Projekte" width="275" height="178" /></li>
<li><img class="projekteimage" title="Projekte" src="img/projekte.jpg" alt="Projekte" width="275" height="178" /></li>
<li><img class="projekteimage" title="Projekte" src="img/projekte.jpg" alt="Projekte" width="275" height="178" /></li>
<li><img class="projekteimage" title="Projekte" src="img/projekte.jpg" alt="Projekte" width="275" height="178" /></li>
<li><img class="projekteimage" title="Projekte" src="img/projekte.jpg" alt="Projekte" width="275" height="178" /></li>
<li><img class="projekteimage" title="Projekte" src="img/projekte.jpg" alt="Projekte" width="275" height="178" /></li>
<li><img class="projekteimage" title="Projekte" src="img/projekte.jpg" alt="Projekte" width="275" height="178" /></li>
<li><img class="projekteimage" title="Projekte" src="img/projekte.jpg" alt="Projekte" width="275" height="178" /></li>
<li><img class="projekteimage" title="Projekte" src="img/projekte.jpg" alt="Projekte" width="275" height="178" /></li>
</ul>
</section>
</div>
Which leads to (sorry due to my status i am not allowed to post images yet - but in this case they are essential so i placed a direct link):
https://dl.dropbox.com/u/8578/sample.png
So a div is wrapping the content of the page. The header is carrying the logo (not shown in the screenshot beneath) and a nav. Then comes an aside element for that grey box floating. Beneath several sections (like register cards) are placed. I've included only one partially in the screenshot. Each register card should cover the screen in its complete width. In between each register card the background image looks through. The background image is placed with #include background-size(cover). As a side note in each register card there should be a bleed on the left and right of about e.g.10% each, so the content is only contained in the center 80%. And the content area of each section contains either matrixes of li (like in the html code above) or columns of 1 to 3 placing divs of content. A few parts of the css i used so far:
$base-font-size: 17px;
$base-line-height: $base-font-size * 1.5;
$total-columns: 20;
$column-width: 4em;
$gutter-width: 1em;
$grid-padding: $gutter-width;
#mixin bleed($padding: $grid-padding, $sides: left right) {
#if $sides == 'all' {
margin: - $padding;
padding: $padding;
}
#else {
#each $side in $sides {
margin-#{$side}: - $padding;
padding-#{$side}: $padding;
}
}
}
* {
#include box-sizing(border-box);
}
body {
background: url('../img/body-bg.jpg') no-repeat center center fixed;
#include background-size(cover);
color:#333;
padding:0;
margin:0;
width: 100%;
font-size: $base-font-size;
font-family: "Signika", Georgia, serif;
#include establish-baseline;
}
.wrapper {
width:100%;
#include container;
#include susy-grid-background;
#include bleed;
}
Within the wrapper at the end the aside as well as sections reside. the basic question are as follows:
a) A general question about best practice first. In the described example would it be enough to place one single container in the wrapper div or would it better to create several containers and would those containers align to each other then if placed throughout the document?
Means either one container for all or one container for the header, one for the aside element and one for each section?
b) Would it be thoughtful to create a container for the aside element. Means one bleed on the left one column content area and one bleed on the right? Or would it be disadvantageous to use an container in that case at all?
c) Looking at the sections is it basically possible at all to let a section fill the whole width of the screen, having on each side a bleed of x columns (placed with pad()? ) and centered in the middle the "content" area splitted into x columns (with span-columns).
d) As seen in the screenshot; at the top of each section there are two arrows pointing at each other. Each arrow consists of a content box containing the text as well as a before and after pseudo class containing a triangle and a rectangle. Latter should stretch till the side of the screen on each side. Would it make sense and be possible to get an responsive css only solution by placing each element within a column:
col1 col2 col3 col4 col5
rectangle content triangle content rectangle
left and right
by assigning a width of 100% each element should fill the full width of the column it is in while be also responsive. And if this idea might work out would it be necessary to create two containers for each section (one for the arrows one for the content with bleeds beneath) or would one be enough?
e) Last question is about the application. If i use :
.moodlegrid li{
#include column-count(3);
#include column-gap(1em);
#include inline-list;
}
it looks like the screenshot from the beginning. If i use the Susy mixins i get the following:
.moodlegrid li{
#include span-columns(4,12);
#include span-columns(4,12);
#include span-columns(4 omega,12);
#include inline-list;
}
and the results look like this:
https://dl.dropbox.com/u/8578/result2.png
Well that's it for now. I am still a bit confused and unsure about best practices as well as if i am doing everything all right so far. ;) Any hints and suggestions would be appreciated. Thanks in advance Ralf

a) I use one container when possible, but multiple containers can be useful (and will align) in certain cases.
b) I don't understand the question. I would simply use squish() to add space to the left and the right.
c) I have not idea what you are asking. Yes, you can have elements span the full screen. You can do it by using multiple containers inside your structural elements (rather than one wrapping them all), or a very large value for bleed. Is that what you mean?
d) I would simply add a large bleed on the left of one, and the right of the other. Then use generated content for the triangles. You don't need your bleed to be responsive to the edge of the screen - you can simply overflow that edge and add overflow-x: hidden; where needed to keep scrollbars from appearing.
e) this code doesn't make any sense. Maybe you wanted this?
.moodlegrid li {
#include span-columns(4,12);
#include nth-omega(3n);
}
Even then, it looks like you may be having issues with float clearing or margin collapsing or something else unrelated.
It would help in the future if you asked each question separately and created specific code examples for each one - rather than lumping them together with one large and complex example. That would also help you debug the problems yourself. Simplify the problem so it is manageable, and then try out the different ideas you have.

Related

Vuetify Overflow On A Flex Column Causing Entire Page to Overflow

In my three-column Vuetify layout, I have one column that is very tall. I want only this column to have a scroll bar. However, the code below causes the entire page to overflow! Any help?
<template>
<v-container fluid class="secondary fill-height">
<v-row class="fill-height ">
<v-col class="accent rounded overflow-y-auto" cols="2">
<div class="text-center">
Lorem ipsum....super long
</div>
</v-col>
<v-col class="primary rounded" cols="5">Editor</v-col>
<v-col class="success rounded" cols="5">Stage Stuff</v-col>
</v-row>
</v-container>
</template>
Add max-height: calc(100vh - 48px) style to the div that encloses the long stuff.
<template>
<v-container fluid class="secondary fill-height">
<v-row class="fill-height">
<v-col class="accent rounded overflow-y-auto" cols="2">
<!-- Add max-height to this div so its height won't expand past the viewport's height -->
<div class="text-center" style="max-height: calc(100vh - 48px)">
Lorem ipsum....super long
</div>
</v-col>
<v-col class="primary rounded" cols="5">Editor</v-col>
<v-col class="success rounded" cols="5">Stage Stuff</v-col>
</v-row>
</v-container>
</template>
Basically, you just limit the max height of the div when its content gets longer. The 100vh is the full height of the viewport. The 48px is the cumulative vertical padding of <v-container /> and the <v-col />.
See live demo.
Note:
The 48px comes from the cumulative vertical paddings/margins/borders of the whole page. In our case, it is the 12px top and bottom padding of the <v-container/> plus 12px top and bottom padding of the <v-col/>. This is a known trick when we want to achieve a full pager div. You can read more here: https://dev.to/lennythedev/css-gotcha-how-to-fill-page-with-a-div-270j

How to change the opacity of a background colour - BG-INFO Opacity

I have checked the forum and other forums
I have this in my code. However, I need to change the opacity to 50%. I can't for the life in me figure out what to do. Please could you help?
<a class="p-2 mb-2 bg-info text-white>
Many thanks
Luke
Opacity takes the value from 0 to 1. Not percentage.
You can add a class to your object as:
<a class="p-2 mb-2 bg-info text-white half-opacity" >
Then you can define the CSS class as:
half-opacity {
opacity: 0.5;
}

Align top left and bottom right with material design

I might be getting this completely wrong, but trying to create a webpage where Div 1 is in top left corner, and div 2 is aligned bottom right (or end end). And I wanted to do this in the right way using material design.
I want it like this (sorry for the ASCII art, but it is cool)
_____________33____50________________
| | |
| 1 | |
| | _________________| 33
-------------| | |
| | 2 |
| | |
| | |
--------------------------------------
50
Here is the code so far, but the problem is I can get it to affect the alignment on column one, but I cant set them independently on the two divs
<md-content layout="column" layout-fill>
<div layout="column" flex="33"><H1>Welcome to My page</H1>
</div>
<div layout="row" layout-align="end end" flex="33">
<div layout="column" layout-align="end end" flex="50">
<H3>Welcome to my page</H3>
<p>This is my page, there are many like it <bold>But this page is mine</bold></p>
<ul>
<li>
My page is my best friend
</li><li>
I must master its code
</li><li>
like I must master my life
</li>
</ul>
</div>
</div>
</md-content>
Not certain the JS fiddle works at all, managed to get the first bit working, but cant get the end. Is this just because we don't know how big the screen is?
Here is a simple JS fiddle, and Material Design is working, and I can get the flex to work, but not the align
https://jsfiddle.net/p02Ls1dh/3/
OK, sorry, me being silly, material design still don't know the height, so the way to do it is to set height (you can use javascript and window) to set the height to say 900px (style="height: 900px;" below), once that is done it works.
<md-content layout="column" layout-fill style="height: 900px">
<div layout="column" flex="33"><H1>Welcome to My page</H1>
</div>
<div layout="row" layout-align="end end" flex="33">
<div layout="column" layout-align="end end" flex="50">
<H3>Welcome to my page</H3>
<p>This is my page, there are many like it <bold>But this page is mine</bold></p>
<ul>
<li>
My page is my best friend
</li><li>
I must master its code
</li><li>
like I must master my life
</li>
</ul>
</div>
</div>
</md-content>

Matrix fields & flexslider

I'm using the flexslider to create a carousel of pictures and use channel entries to populate the list items (images) that the flexslider uses to create the carousel.
Now I want to add a link to a pdf on al those list items that I have in a matrix field in the channel and that works also but only for the first list item.
Anybody knows why this is?
<div class="flexslider">
<ul class="slides">
{exp:channel:entries channel="lr_press"}
{if press_slider_switch != ""}
{press_artikel}
<li><img src="{press_beeld}" alt="{title}" /></li>
{/press_artikel}
{/if}
{/exp:channel:entries}
</ul>
</div>

inline image drops below span element filled with text (both are inside <li> in a list)

I came upon strange situation. I have a List and each list item consists of span and image element. They are both inline and as long as span is empty they are next to each other, but when span has text, image acts as if it was display:block and falls underneath the span element which is not my desired effect. (I fill span with text dynamically)
<ul id="playerListInsideRoom">
<li class="playerCircleInsideRoom circleFull" seatnumber="1">
<img src="~/Images/Lobby/successGray.png" alt="image" /><span> </span></li>
<li class="playerCircleInsideRoom circleEmpty" seatnumber="2">
<img src="~/Images/Lobby/successGray.png" alt="image" /><span></span></li>
<li class="playerCircleInsideRoom circleEmpty" seatnumber="3">
<img src="~/Images/Lobby/successGray.png" alt="image" /><span></span></li>
<li class="playerCircleInsideRoom circleEmpty" seatnumber="4">
<img src="~/Images/Lobby/successGray.png" alt="image" /><span></span></li>
</ul>
.playerCircleInsideRoom span{
position:relative;
left:50px;
}
#playerListInsideRoom img {
height:15px;
width:15px;
display:inline-block;
position:relative;
right:40px;
}
Even when I get rid of relative positions the problem is still occuring.
If the width of inline elements is larger than the allowed width of the container (your li element) then the line will break.
You could use whitespace: nowrap on the li to prevent it (though that could possibly break the rest of your layout).

Resources