我clearfixed父元素,但我不知道如何解決這類問題,它的發生,因爲我扣除LOREM lpsum的長度從一些容器,它的錯位。CSS clearfix問題浮動
@import url(https://fonts.googleapis.com/css?family=Amaranth|Titillium+Web);
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
\t margin: 0;
\t padding: 0;
\t border: 0;
\t font-size: 100%;
\t font: inherit;
\t vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
\t display: block;
}
body {
\t line-height: 1;
}
ol, ul {
\t list-style: none;
}
blockquote, q {
\t quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
\t content: '';
\t content: none;
}
table {
\t border-collapse: collapse;
\t border-spacing: 0;
}
body {
\t width:100vw;
\t height:100vh;
\t /*background-image: url(../images/background.svg);*/
\t background-color: #1abc9c;
\t box-sizing: border-box;
}
::selection {
\t color:#e74c3c;
\t background-color: #ecf0f1;
}
.container {
\t width:85vw;
\t height:auto;
\t margin:0 auto;
\t
}
.container header {
\t background-color: rgb(236, 240, 241);
}
.container header::after {
\t content: "";
\t display: block;
\t clear:both;
}
.container header h1 {
\t float:left;
\t font-size: 3rem;
\t font-size: 4vw;
\t padding:1% 1%;
\t font-family: 'Amaranth', sans-serif;
}
.container header .m_link {
\t float:right;
\t padding:0.5vw;
}
.container header .m_link h4 {
\t font-family: 'Amaranth',sans-serif;
\t font-weight: 200;
\t color:#2c3e50;
\t font-size: 1rem;
\t font-size: 1vw;
}
.container header .m_link h4:nth-child(2) {
\t text-align: right;
}
.container section {
\t margin-top:1vw;
\t padding:0.1vw;
\t
}
.container section::after {
\t display: table;
\t content:"";
\t clear:both;
}
.container section .wcon {
\t width: 19vw;
\t height:auto;
\t border:0.5vw solid #ecf0f1;
\t border-radius:1vw;
\t background-color: #ecf0f1;
\t float:left;
\t margin:0 0.6vw 0.6vw 0.6vw;
\t padding:0.5vw 0;
}
.container section .wcon:hover {
\t background-color: ;
\t border-color:#2c3e50;
\t cursor: pointer;
}
.container section .wcon:after {
\t
\t clear: both;
\t display: table;
\t content:"";
}
.container section .wcon .img_icon {
\t display: block;
\t margin:0 auto;
\t width:18vw;
\t height: auto;
}
.container section .wcon h3 {
\t font-family: 'Titillium Web',sans-serif;
\t text-align: center;
\t font-size: 1.5rem;
\t font-size: 2vw;
\t font-weight: 500;
\t color:#2c3e50;
\t text-transform: uppercase;
\t padding:0.1vw 0;
}
.container section .wcon p {
\t text-align: justify;
\t font-size: 0.8rem;
\t font-size: 1vw;
\t font-family: 'Titillium Web',sans-serif;
\t font-weight: 100;
\t padding:0 0.2vw;
\t line-height: 1.3;
\t color:#34495e;
}
.container section .wcon p:after {
\t content:" Read More";
}
<DOCTYPE html>
<html>
\t <head>
\t \t <title> Projects </title>
\t \t <link rel="stylesheet" href="css/style.css">
\t </head>
\t <body>
\t \t \t <div class="container">
\t \t \t \t <header>
\t \t \t \t \t <h1> Projects </h1>
\t \t \t \t \t
\t \t \t \t </header>
\t \t \t </div>
\t \t \t <div class="container">
\t \t \t \t <section>
\t \t \t \t \t <div class="wcon">
\t \t \t \t \t \t <img src="http://placehold.it/250X150/#e74c3c/#ecf0f1" alt="" class="img_icon">
\t \t \t \t \t \t <h3> project name </h3>
\t \t \t \t \t \t <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin placerat, erat non vulputate bibendum, est est placerat felis, id consectetur mi nibh ac nisl. Donec congue mauris id felis bibendum, sit amet accumsan erat semper. Donec vitae nunc luctus, gravida sapien at, commodo dolor. </p>
\t \t \t \t \t </div>
\t \t \t \t \t <div class="wcon">
\t \t \t \t \t \t <img src="http://placehold.it/250X150/#e74c3c/#ecf0f1" alt="" class="img_icon">
\t \t \t \t \t \t <h3> project name </h3>
\t \t \t \t \t \t <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin placerat, erat non vulputate bibendum, est est placerat felis, id consectetur mi nibh ac nisl. Donec congue mauris id felis bibendum, sit amet accumsan erat semper. Donec vitae nunc luctus, gravida sapien at, commodo dolor.</p>
\t \t \t \t \t </div>
\t \t \t \t \t <div class="wcon">
\t \t \t \t \t \t <img src="http://placehold.it/250X150/#e74c3c/#ecf0f1" alt="" class="img_icon">
\t \t \t \t \t \t <h3> project name </h3>
\t \t \t \t \t \t <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin placerat, erat non vulputate bibendum, est est placerat felis, id consectetur mi nibh ac nisl. Donec congue mauris id felis bibendum, sit amet accumsan erat semper. Donec vitae nunc luctus, gravida sapien at, commodo dolor.
\t \t \t \t \t \t </p>
\t \t \t \t \t </div>
\t \t \t \t \t <div class="wcon">
\t \t \t \t \t \t <img src="http://placehold.it/250X150/#e74c3c/#ecf0f1" alt="" class="img_icon">
\t \t \t \t \t \t <h3> project name </h3>
\t \t \t \t \t \t <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin placerat, erat non vulputate bibendum, est est placerat felis, id consectetur mi nibh ac nisl. Donec congue mauris id felis bibendum, sit amet accumsan erat semper. Donec vitae nunc luctus, gravida sapien at, commodo dolor. </p>
\t \t \t \t \t </div>
\t \t \t \t \t <div class="wcon">
\t \t \t \t \t \t <img src="http://placehold.it/250X150/#e74c3c/#ecf0f1" alt="" class="img_icon">
\t \t \t \t \t \t <h3> project name </h3>
\t \t \t \t \t \t <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin placerat, erat non vulputate bibendum, est est placerat felis, id consectetur mi nibh ac nisl. Donec congue mauris id felis bibendum, sit amet accumsan erat semper. Donec vitae nunc luctus, gravida sapien at, commodo dolor. </p>
\t \t \t \t \t </div>
\t \t \t \t \t <div class="wcon">
\t \t \t \t \t \t <img src="http://placehold.it/250X150/#e74c3c/#ecf0f1" alt="" class="img_icon">
\t \t \t \t \t \t <h3> project name </h3>
\t \t \t \t \t \t <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin placerat, erat non vulputate bibendum, est est placerat felis, id consectetur mi nibh ac nisl. Donec congue mauris id felis bibendum, sit amet accumsan erat semper. Donec vitae nunc luctus, gravida sapien at, commodo dolor.</p>
\t \t \t \t \t </div>
\t \t \t \t \t <div class="wcon">
\t \t \t \t \t \t <img src="http://placehold.it/250X150/#e74c3c/#ecf0f1" alt="" class="img_icon">
\t \t \t \t \t \t <h3> project name </h3>
\t \t \t \t \t \t <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin placerat, erat non vulputate bibendum, est est placerat felis, id consectetur mi nibh ac nisl. Donec congue mauris id felis bibendum, sit amet accumsan erat semper. Donec vitae nunc luctus, gravida sapien at, commodo dolor.
\t \t \t \t \t \t </p>
\t \t \t \t \t </div>
\t \t \t \t \t <div class="wcon">
\t \t \t \t \t \t <img src="http://placehold.it/250X150/#e74c3c/#ecf0f1" alt="" class="img_icon">
\t \t \t \t \t \t <h3> project name </h3>
\t \t \t \t \t \t <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin placerat, erat non vulputate . </p>
\t \t \t \t \t </div>
\t \t \t \t \t <div class="wcon">
\t \t \t \t \t \t <img src="http://placehold.it/250X150/#e74c3c/#ecf0f1" alt="" class="img_icon">
\t \t \t \t \t \t <h3> project name </h3>
\t \t \t \t \t \t <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin placerat, erat non vulputate bibendum, est est placerat felis, id consectetur mi nibh ac nisl. Donec congue mauris id felis bibendum, sit amet accumsan erat semper. Donec vitae nunc luctus, gravida sapien at, commodo dolor. </p>
\t \t \t \t \t </div>
\t \t \t \t \t <div class="wcon">
\t \t \t \t \t \t <img src="http://placehold.it/250X150/#e74c3c/#ecf0f1" alt="" class="img_icon">
\t \t \t \t \t \t <h3> project name </h3>
\t \t \t \t \t \t <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin placerat, erat non vulputate bibendum, . </p>
\t \t \t \t \t </div>
\t \t \t \t \t <div class="wcon">
\t \t \t \t \t \t <img src="http://placehold.it/250X150/#e74c3c/#ecf0f1" alt="" class="img_icon">
\t \t \t \t \t \t <h3> project name </h3>
\t \t \t \t \t \t <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin placerat, erat non vulputate bibendum, est est placerat felis, id consectetur mi nibh ac nisl. Donec congue mauris id felis bibendum, sit amet accumsan erat semper. Donec vitae nunc luctus, gravida sapien at, commodo dolor.</p>
\t \t \t \t \t </div>
\t \t \t \t </section>
\t \t \t </div>
\t </body>
</html>
只是一個單一的問題,相信我,沒有落後,但只是我想知道的。當「老年人」列出時,您的答案現在第一次如何呢?這不是第一次?編輯是否改變了順序?而且,再次相信我,這不是什麼違反你的回答,它是更好,更詳盡,更多的選擇。 (其實你的upvote是我的) –
@AlvaroMenéndez謝謝你的讚賞:)我在寫我的之前閱讀你的答案(我在寫關於一個很好的HTML解決方案時指的是它),另一個現在刪除了關於JS解決方案作爲「不需要JS解決方案」),但似乎接受的答案總是首先根據[元](http://meta.stackoverflow.com/questions/299343/newer-answer-appearing-as-oldest-when -sorting逐最舊)。如果它還沒有被接受,那麼有一個問題... – FelipeAls
這不是當我發表評論,但因爲我不是100%肯定它,也許我只是想念它。無論如何。好的工作,並且見到你(也許)任何其他日子:) –