Move div to new line

Lucas

I'm pretty new to CSS and it is still magic for me.
I want to have my div movie_item_content_plot on a new line. Currently I use <br> in HTML and this works fine. When I replace the <br> with clear: both; the div appears between movie_item_poster and movie_item_toolbar - but this is not what I want to have. It should be in movie_item_content but under movie_item_year and movie_item_plot.

Here is a fiddle to play around with.

wanted layout (<br>)

wanted layout

wrong layout (clear: both;)

wrong layout

HTML

<div id="movie_item">
    <div class="movie_item_poster">
        <img src="..." style="max-width: 100%; max-height: 100%;">
    </div>

     <div id="movie_item_content">
        <div class="movie_item_content_title">title</div>
        <div class="movie_item_content_year">year</div>
        <br> <!-- I want to replace this br -->
        <div class="movie_item_content_plot">plot</div>
    </div>

    <div class="movie_item_toolbar">
        Lorem Ipsum...
    </div>
</div>

CSS

#movie_item {
    display: block;
    margin-top: 10px;
    height: 175px;
}

.movie_item_poster {
    float: left;
    height: 150px;
    width: 100px;
}

.movie_item_content {
    float: right;
}

.movie_item_content_title {
    float: left;
}

.movie_item_content_year {
    float: right;
}

.movie_item_content_plot {

}

.movie_item_toolbar {
    clear: both;
    vertical-align: bottom;
    width: 100%;
    height: 25px;
}
god_is_love

What about something like this.

<div id="movie_item">
    <div class="movie_item_poster">
        <img src="..." style="max-width: 100%; max-height: 100%;">
    </div>

     <div id="movie_item_content">
        <div class="movie_item_content_year">year</div>
        <div class="movie_item_content_title">title</div>
        <div class="movie_item_content_plot">plot</div>
    </div>

    <div class="movie_item_toolbar">
        Lorem Ipsum...
    </div>
</div>

You don't have to float both movie_item_poster AND movie_item_content. Just float one of them...

#movie_item {
    position: relative;
    margin-top: 10px;
    height: 175px;
}

.movie_item_poster {
    float: left;
    height: 150px;
    width: 100px;
}

.movie_item_content {
    position: relative;
}

.movie_item_content_title {
}

.movie_item_content_year {
    float: right;
}

.movie_item_content_plot {
}

.movie_item_toolbar {
    clear: both;
    vertical-align: bottom;
    width: 100%;
    height: 25px;
}

Here it is as a JSFiddle.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

4 div's in one line, move div to new line

From Dev

Center divs in center and move new line div to left

From Dev

<div> will not move down a line

From Dev

Move to the beginning of New Line - VIM

From Dev

Vim - move rest of line to new line above

From Dev

Place div in new line

From Dev

how to move cursor directly to the next new line?

From Dev

Move each Cell after column A on new line

From Dev

Move ConEmu prompt to new line following path?

From Dev

New line in text inside div

From Dev

New line is not working in editable div

From Dev

how to make div to new line

From Dev

html css move img to the top line of div

From Dev

Use css to move div to a new location then stop there

From Dev

Jquery Autocomplete move items to new div

From Dev

How to make div transition move on hover and reveal new div

From Dev

Trigger event on new line in content editable div

From Dev

Div element not going to new line in css

From Dev

css relative positioning breaks div into new line

From Dev

Bootstrap push div content to new line

From Dev

Inline-block div starts a new line

From Dev

Resizable div puts textbox on new line?

From Dev

How to prevent Div from creating a new line

From Dev

add text to div. New line

From Dev

Why is this text pushing the div onto a new line?

From Dev

How to move opening curly braces to a new line in Vim?

From Dev

Place buttons and text on new line and move them to the bottom of the screen in java

From Dev

Responsive table: move cell to new line if table too small

From Dev

Command-Line Option to Open Chrome in New Window and Move Focus