Vertical spacing between display:inline divs in a fluid grid - css

Ok, not too sure where to start...
I'm putting myself together a blogger, completely gutting it's css and just using it as a simple content manager. here is the test site i've been working with
http://jamesparishtestblog.blogspot.com/
Ignore the header, its broken, but I know what I'm doing there. My problem is with the film reviews (stolen from apple trailers as temp content). As you resize the page, they flow fluidly into rows of different lengths. Great! Trouble is, the second row (and thus third, fourth, etc.) aligns itself vertically to the bottom of the longest (lowest) div in the above row. However, I want each div to fit neatly below the one above, 15px apart, and to flow neatly if another div is expanded (by clicking read more...).
Placing the divs in a column is ruled out, because I want the top row to contain the most recent posts side by side (with a column they would be below one another on the left hand side).
Set heights for the divs is ruled out too, because the articles need to expand, and for the full desired design, be mis-matched intentionally.
This has been troubling me for hours. I hope I've explained myself clearly, and that someone will can help.
Thanks for your time.

So you want this?
--------------------------
| __________ _______ |
| | | | | |
| | | | | |
| | | | | |
| ---------- | | |
| __________ | | |
| | | |_____| |
| | | _______ |
| | | | | |
| ---------- | | |
| ------- |
|________________________|
Without using columns you can't do it relying on CSS alone. You'd need to use some javascript or server side stuff to put things in the right place. Essentially you want a collage, too bad there's no "display: collage"!
Of course, I could be completely misunderstanding you.
Edit:
"any suggestions on the javascript front?"
I use mootools for almost all my sites. I'll define a bit there first:
dispose : takes an element out of the dom and stores it in a variable.
inject : plops an element into the dom.
I'd load these into columns, then dispose all the ones in the "recent" column and inject them back in to the top of the rest of the columns, one for each column. In other words, all the layout is done with CSS, the only javascript going on is putting your "recent" stuff as the top "row".

Related

QGraphicsItem under cursor at leaving object while over another item

I have a QGraphicsScene, QGraphicsView and some QGraphicsItems subclassed.
I want to track which item is under the cursor topmost visible.
It works fine using hoverEnterEvent in most situations, but if I have two Objects where one is on top of another it does work on entering both but not on leaving the inner object (and re-entering the outer, since it never left the outer in the first place).
+-------------------------------------+
outside | |
| outer |
| |
| |
| +-------------+ | +-------------+
| | | | | |
| | | | | another |
| | inner | | | |
| | | | | |
| | | | +-------------+
| +-------------+ |
| |
| |
| |
| |
+-------------------------------------+
outside -> outer : works, outer is selected
outside -> outer -> outside -> another : works, first outside is selected, than nothing, than another
outer -> inner : works, inner is seletected
outside -> outer -> inner -> outer: does not work, first outside is selected, than inner, but than nothing (should be outer again)
What can I do, besides looping trough all graphicitems triggered via a slight delayed singleshot on hoverLeaveEvent?
Edit:
I found a temporary solution:
I added a global QList < MyQGraphicsItem *> where on MyQGraphicsItem::hoverEnterEvent I add "this", and on MyGraphicsItem::hoverLeaveEvent I remove the last item in the List. So the myGlobalQList.last() always contains the topmost item visible under the cursor.
I assume this is not the best solution since QList is not threadsafe, therefor I am still interested in other solutions.
Your QGraphicsItems live in a QGraphicsScene which can be displayed by one or more QGraphicsViews.
I know that the model-view mapping usually is 1:1.
Still I suggest to implement mouse handling like this in your view, not in the scene:
Install an eventFilter on your graphicsView->viewport().
Override the eventFilter() function in your filter class.
Watch for QEvent::MousePress, MouseMove, MouseRelease, maybe Enter and Leave, depending on what you need.
Probably you need to setMouseTracking(true) on the viewport.
Then, in the event filter function, use QGraphicsView::mapToScene() and QGraphicsScene::itemAt() to find the topmost item, or ::items() to find all items under the cursor.
I recently used this to decorate the topmost item with a border by painting over the view (QGraphicsView::drawForeground()).

Cropping an animation in a way this is compatible with column-count

This is related to Creating a peek in effect with animate.css which was answered via using overflow:hidden, but does not work with column-count:
I am using the excellent animate.css library for animations. I was wondering if its possible to create a "peek in" and "peek out" effect that is similar to the SlideIn/SlideOut but with the following difference:
slideOutRight
+-------------+ +-------------+
| | | |
| | | |
| +---------+ | +---+----+
| | anim | | | anim |
| +---------+ | +---+----+
| | | |
+-------------+ +-------------+
peekOutRight
+-------------+ +--------------+
| | | |
| | | |
| +---------+ | +----+
| | anim | | | an|
| +---------+ | +----+
| | | |
+-------------+ +--------------+
In other words, the difference is that peek does not go out of the parent object boundaries. I've tried adding clip/clip-path to the anim element but it does not look like translate3d takes that into account.
The slideInRight/OutRight code of animate.css is pretty straighforward -
It's moving X by 100% - I'd like to make sure it gets cropped as it moves out of the parent frame.
I've setup a codepen to illustrate this in action - would appreciate any advice
http://codepen.io/pliablepixels/pen/pgxqOX
The caveat is that it must work with -column-count. as you see in the codepen, the moment you use column-count, the 2nd column does not show the header
Added Clarification on why I need it to work with columns:
I need to pack the frames so that odd sized frames are not arranged by row. This codepen illustrates the issue of using flex-row vs. column-count -http://codepen.io/pliablepixels/pen/MKPLBp
If you switch to byrow you'll see images are aligned in a way that the row takes up the height of the largest image, which means if you reduce the browser width,"D" goes to row 3 instead of going under "C". Switch to column mode and it packs in better.

How to extend side dock widgets vertically even when top/bottom docks are present?

Currently if I have QDockWidgets at the top, bottom and on the sides of my QMainWindow, they are arranged like this:
_____________________
| |
|_____________________|
| | | |
| | | |
| | | |
|___|_____________|___|
| |
|_____________________|
I'd like to have one of the side docks more extended vertically, like this:
_____________________
| | |
|_________________| |
| | | |
| | | |
| | | |
|___|_____________| |
| | |
|_________________|___|
How can I do this with QDockWidget? I've tried looking at the various options in Designer, looked through all the documentation of QDockWidget and QMainWindow multiple times, but haven't found anything relevant. Do I have to create my own layout for this, or maybe subclass QMainWindow?
void QMainWindow::setCorner(Qt::Corner corner, Qt::DockWidgetArea area)
Elaborating on #Tomas's answer. Qt documentation says:
void QMainWindow::setCorner ( Qt::Corner corner, Qt::DockWidgetArea area )
Sets the given dock widget area to occupy the specified corner.
It is in fact misleading: the area won't occupy just the specified corner. Rather this corner will belong to the area, i.e. you can set multiple corners to a single area, so you'd get e.g. side area at right with bottom-right corner, or with top corner, or with both.

Column width is not fully filled after reordered

I'm creating a website based on unequal column, the site divided by .col-md-2 and .col-md-10 and it's look like this:
-------------------------------------
|Side | Content |
| | |
| | |
-------------------------------------
And then I want divide the content again into 2 unequal columns with <aside>, I want it has same layout styling, so inside .col-md-10, i uses .col-md-8 for Content and col-md-4 for <aside>, so it's look like this:
-----------------------------------------
|Side | Content | Aside |
| | | |
| | | |
-----------------------------------------
Inside Content I want to fill it with <article>, and each of it has Detail and I want put it on Side position while the content <article> still inside the Content.
To achieve this, I split <article> into 2 unequal columns again and pull each of them, so it uses .col-md-pull-4 .col-md-4 and .col-md-pull-4 .col-md-8, and currently, it looks like:
-----------------------------------------
|Side | Content | Aside |
|(Detail) | (Article) *| | |
| | | |
-----------------------------------------
the layout works as expected, however the Article width only reach until *|
if i use .col-md-pull-4 .col-md-12 on <article> content, it will looks like this
-----------------------------------------
|Side | Content | Aside |
|(Detail) | | |
| | (Article) | |
| | | |
-----------------------------------------
The article has full width, but it create a new "row"
the output i want is:
-----------------------------------------
|Side | Content | Aside |
|(Detail) | (Article) | |
| | | |
-----------------------------------------
Update
Here is my current code on bootply
Progress
I haven't figure out how to do this, but basically, what i want is pull a column outside of its container / parent and fill the container with another column, if you think i was doing it wrong, provide a correct way to achieve this kind of layout is very appreciated.
Update 2
Finally I ended up messing with margin-left property with minus values, since it displayed incorrectly under specific resolution, i have to use media queries to workaround against it.
If there are better ways to achieve this kind of layout, correct me how to implement this will be very appreciated

CSS - How to add a second background image

Request:
I am trying to make my website have a background where it repeats along the x-axis, but when it finishes on the y-axis it display a different image. I would like it to continue.
Example:
---------------
| |
| (ORIGINAL) | (repeats on x-axis)
| |
---------------
| (SECOND) |
| |
---------------
| (SECOND) |
| |
---------------
| (SECOND) |
| |
---------------
| (SECOND) |
| |
---------------
(Etc.)
How would I accomplish this?
Use the multiple backgrounds CSS3 feature http://www.w3.org/TR/css3-background/#layering
Have a look at a jsfiddle live example at http://jsfiddle.net/pWw2A/
body {
background: url(http://placehold.it/150x80/ff0000/ffffff) repeat-x,
url(http://placehold.it/150x50/00ff00/000000) 0 80px repeat-y;
}
First the scrolling background can be done with background-attachment:fixed;
Then for the multiple backgrounds you'll need to use CSS3 Like this: http://www.w3schools.com/css3/tryit.asp?filename=trycss3_background_multiple
This tutorial might help you to achieve what you want:
http://nicolasgallagher.com/multiple-backgrounds-and-borders-with-css2/
It has a nice example on how to do this (mixed with the fixed background will be is more or less what you want):
http://silverbackapp.com/
HOPE IT HELPS!

Resources