html - WordPress float in article -
html - WordPress float in article -
i made website wordpress , have problem float in article.
http://img4.hostingpics.net/thumbs/mini_756574capturedcran20141013181858.png
has can see, when sidebar finish, content go left , don't want that. want content in right. want content below other.
my code:
html (all article on tag:
<div id="container"> <aside id="sidebar" role="complementary"> code of sidebar here... </aside> <article id="post-53" class="post-53 post type-post status-publish format-standard hentry category-non-classe">code of article here...</aticle> </div>
css:
#container { width:100%; margin:0 auto; max-width:1000px; margin-top:-3%; } aside{ width:30%; text-align:left; max-width:280px; padding:2%; float:left; background-color: #fff; -webkit-box-shadow: 1px 1px 0 0 rgba(0,0,0,0.1); box-shadow: 1px 1px 0 0 rgba(0,0,0,0.1); margin-left:5%; margin-top:2%; margin-bottom:2%; height: 100%; } article { background-color: #fff; width:50%; height:100%; margin:1%; margin-top:2%; margin-left:4%; padding:2%; -webkit-box-shadow: 1px 1px 0 0 rgba(0,0,0,0.1); box-shadow: 1px 1px 0 0 rgba(0,0,0,0.1); max-width:550px; float:left; }
thank :)
you can wrap container element around articles, , float container instead of individual articles. give article container specific width 48% (or whatever). long width of aside , width of article container, along padding/margins, adds 100% or less, live next each other. articles remain within container instead of slipping left. problem you're having due fact articles have same parent element (#container
) aside
. 1 time there plenty articles force downwards past aside, float left against parent container (#container
).
for example, can wrap div around articles so:
<div id="container"> <aside id="sidebar" role="complementary">code of sidebar here...</aside> <div id="content-wrapper"> <article id="post-53" class="post-53 post type-post status-publish format-standard hentry category-non-classe">code of article here...</article> <article id="post-54" class="post-54 post type-post status-publish format-standard hentry category-non-classe">code of article here...</article> <article id="post-55" class="post-55 post type-post status-publish format-standard hentry category-non-classe">code of article here...</article> <article id="post-56" class="post-56 post type-post status-publish format-standard hentry category-non-classe">code of article here...</article> </div> </div>
then in css:
#content-wrapper { float:left; width: 48%; margin-left: 2%; }
be sure remove float articles, , watch spelling -- closing tag on </article>
spelled incorrectly in html.
fiddle: http://jsfiddle.net/wwaxy073/1/
html css wordpress css-float
Comments
Post a Comment