Javascript-форум (https://javascript.ru/forum/)
-   (X)HTML/CSS (https://javascript.ru/forum/xhtml-html-css/)
-   -   Расположение блоков новостей, с помощью html и css (https://javascript.ru/forum/xhtml-html-css/68680-raspolozhenie-blokov-novostejj-s-pomoshhyu-html-i-css.html)

butik 02.05.2017 14:53

Расположение блоков новостей, с помощью html и css
 
Здравствуйте.

Подскажите пожалуйста как можно расположить div блок справо от превью новостей?

Пример изобразил на картинке.


ksa 02.05.2017 15:26

Не список конечно... Но как вариант.

<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=windows-1251' />
<!--
<script src='http://code.jquery.com/jquery-latest.js'></script>
<script src="https://code.angularjs.org/1.3.9/angular.min.js"></script>
<script src="https://code.angularjs.org/1.3.9/angular-route.js"></script>
-->
<style type='text/css'>
* {
	margin: 5px;
}
#container {
	width: 345px;
	border: 1px solid;
}
#right {
	float: right;
	width: 100px;
	height: 215px;
	border: 1px solid;
}
.item {
	display: inline-block;
	width: 100px;
	height: 100px;
	border: 1px solid;
}
</style>
<script type='text/javascript'>
</script>
</head>
<body>
<div id='container'>
	<div id='right'></div>
	<div class='item'></div>
	<div class='item'></div>
	<div class='item'></div>
	<div class='item'></div>
	<div class='item'></div>
	<div class='item'></div>
	<div class='item'></div>
</div>
</body>
</html>

ksa 02.05.2017 16:00

Вот и со списком... Т.с. частный случай.

<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=windows-1251' />
<!--
<script src='http://code.jquery.com/jquery-latest.js'></script>
<script src="https://code.angularjs.org/1.3.9/angular.min.js"></script>
<script src="https://code.angularjs.org/1.3.9/angular-route.js"></script>
-->
<style type='text/css'>
* {
	margin: 5px;
}
#container {
	position: relative;
	width: 330px;
	overflow: hidden;
	border: 1px solid;
}
#right {
	position: absolute;
	top: 0;
	right: 0;
	width: 100px;
	height: 210px;
	background-color: red;
}
ul {
	margin: 0;
	padding: 0;
	overflow: hidden;
}
li {
	float: left;
	width: 100px;
	height: 100px;
	list-style-position: inside;
	list-style-type: none;
	background-color: green;
}
li:nth-child(3),
li:nth-child(5) {
	clear: left;
}
</style>
<script type='text/javascript'>
</script>
</head>
<body>
<div id='container'>
	<div id='right'></div>
	<ul>
		<li></li>
		<li></li>
		<li></li>
		<li></li>
		<li></li>
		<li></li>
		<li></li>
	</ul>
</div>
</body>
</html>

butik 02.05.2017 16:01

Спасибо. Красиво отображается, только ищу вариант без использования дополнительных js https://i.imgur.com/micpyaL.png
Кстати мне еще подсказывали люди masonry.desandro.com

laimas 02.05.2017 16:26

Цитата:

Сообщение от butik
ищу вариант без использования дополнительных js

А где тут JS? А вот masonry, это JS плагин как раз.


Часовой пояс GMT +3, время: 14:10.