Как подвести нижний колонтитул? - PullRequest
0 голосов
/ 02 мая 2019

Я пытался нарисовать простую страницу Blogspot с HTML и CSS. Я разработал некоторые. Теперь я застрял. У меня есть код:

body{
	background-color: #5e769b;
	font: 16px/28px, arial, sans-serif; 
}
.container{
	background-color: #edeff2;
	width: 790px;
	margin: auto;
}
.header{
	padding-bottom: 20px;
	background-color: #6191dd;
	text-align: center;
}
.article{
	padding: 20px;
	text-align: justify;
	background-color: #f9f9f9;
	box-sizing: border-box;
	width: 70%;
	float: left;
}
.sidebar {
	padding: 20px;
	text-align: justify;
	background-color: #f9f9f9;
	box-sizing: border-box;
	width: 30%;
	float: right;
}
.footer{
	padding: 10px;
	text-align: center;
	background-color: #6b4edb;
	box-sizing: border-box;
	width: 100%;
	color: #263959;
}
.footer,
a {
	text-decoration: none;
	color: #fff;
}
<div class="container">
	<div class="header">
		<h1>welcome</h1>
		<h2>test blog</h2>
	</div>
	<div class="article">
		<h2>Article</h2>
		<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
	</div>
	<div class="sidebar">
		<h2>sidebar</h2>
		<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
	</div>
	<div class="footer">
		<h4>CopyRight @ <a href="#">footer</a></h4>
	</div>
</div>

Этот код не позволяет нижнему колонтитулу в нижней части. Нижний колонтитул с боковой панели.

Я хочу нижний колонтитул в нижней части контейнера, как показано на рисунке ниже https://i.imgur.com/PFuGq2I.jpg

Какие изменения я должен внести в CSS или HTML?

Спасибо.

Ответы [ 2 ]

0 голосов
/ 02 мая 2019

поставьте <div> как раньше <div class="footer">.

<div class="footerToBottom"></div>

и добавьте css код для этого сегмента:

.footerToBottom{
    clear:both;
    display:block;
    width:0 !important;
    height:0 !important;
    min-height:0 !important;
    min-width:0 !important;
    margin:0 !important;
    padding:0 !important;
    overflow:hidden
}

body{
	background-color: #5e769b;
	font: 16px/28px, arial, sans-serif; 
}
.container{
	background-color: #edeff2;
	width: 790px;
	margin: auto;
}
.header{
	padding-bottom: 20px;
	background-color: #6191dd;
	text-align: center;
}
.article{
	padding: 20px;
	text-align: justify;
	background-color: #f9f9f9;
	box-sizing: border-box;
	width: 70%;
	float: left;
}
.sidebar {
	padding: 20px;
	text-align: justify;
	background-color: #f9f9f9;
	box-sizing: border-box;
	width: 30%;
	float: right;
}
.footer{
	padding: 10px;
	text-align: center;
	background-color: #6b4edb;
	box-sizing: border-box;
	width: 100%;
	color: #263959;
}
.footer,
a {
	text-decoration: none;
	color: #fff;
}
.footerToBottom{
	clear:both;
	display:block;
	width:0 !important;
	height:0 !important;
	min-height:0 !important;
	min-width:0 !important;
	margin:0 !important;
	padding:0 !important;
	overflow:hidden
}
<div class="container">
	<div class="header">
		<h1>welcome</h1>
		<h2>test blog</h2>
	</div>
	<div class="article">
		<h2>Article</h2>
		<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
	</div>
	<div class="sidebar">
		<h2>sidebar</h2>
		<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
	</div>
	<div class="footerToBottom"></div>
	<div class="footer">
		<h4>CopyRight @ <a href="#">footer</a></h4>
	</div>
</div>
0 голосов
/ 02 мая 2019

Вы кладете свой "нижний колонтитул" в divВы должны использовать тег html.

Так что снимите элемент

...