css: How to float div according to 2nd div in hierarchy

Tags: css,layout

Problem :

I need this blue div to be next to red div, while yellow div must remain in place.


How to do this without using something like position:absolute, float:none - etc... nasty hacks?

Solution :

Add margin-top: -50px to the big div.

Alternatively, you can also wrap the small divs in another div, and float that. Depends on the situation.

And position: absolute, float: none are not nasty hacks at all, they are the best friends of a sitebuilder :).

    CSS Howto..

    jQuery hide/show issue with offset

    Vaadin - How to customize MenuBar to look like links

    Shadow DOM: how to apply CSS style only if the host element is ?

    How to make changes in wordpress template. Css direct edit not working

    How do I achieve this animation using javascript/jquery? [closed]

    How to change active menu item style in html/css/js/php

    How do I align these links inside inline-blocks to the top?

    How do I add hover cursor and still get move cursor on JQuery Table Sortable?

    Tumblr: How to control CSS with post tagging (UPDATE: Working Method without JQuery!)

    How to align a Wordpress navigation bar to the right of a logo?

    How do I put a clear button inside my HTML text input box like the iPhone does?

    How do I apply a css padding to one element but not its child

    How to make list items of one UL with fixed height be displayed as columns?

    How to toggle animate with css display:none

    how to setup css value for “-webkit-transform” in the “animate” method? [duplicate]

    How to auto width a form element with CSS?

    How to make a CSS file valid?

    How to style all the same XSL FO elements? XSL FO like CSS?

    how to make edges round in CSS?

    How should I convert this object from .PSD to HTML/CSS?

    How to vertically align two
    tags perfectly for each resolution?

    how to place image on image?

    How to do something like #Card%{ } in CSS

    CSS: how to make two sections at the same line?

    How can I style flexbox children in a multiline

    How to make iframe use all height available to it

    How to make a dotted underline link on hover?

    R markdown: how to change style with internal css?

    How to add your customise arrows in slick slider JS using CSS

    How to set background image to keep its position while browser width is changing?