Наложение фонов

Наложение фонов с помощью CSS.

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Multiple backgrounds</title>
	<style>
		body {
			font: 14px/1.5 courier, monospace;
			background: white;
			color: black;
			margin: 20px;
		}
	
		pre, #htmldog {
			background-color: #c72;
			height: 200px;
			margin: 20px 0;
			overflow: auto;
		}
		pre code {
			background: white;
			padding: 2px 10px 4px 0;
		}

		#p0, #htmldog {
			background-image: url("https://foxyforex.ru/wp-content/uploads/2023/09/bg.gif");
		}
		#p1 {
			background-image: url("https://foxyforex.ru/wp-content/uploads/2023/10/circle.png"), url("http://www.htmldog.com/examples/images/bg.gif");
		}
		#p2 {
			background-image: url("https://foxyforex.ru/wp-content/uploads/2023/10/circle.png"), url("http://www.htmldog.com/examples/images/bg.gif");
			background-repeat: no-repeat, repeat;
		}
		#p3 {
			background-image: url("https://foxyforex.ru/wp-content/uploads/2023/10/circle.png"), url("http://www.htmldog.com/examples/images/bg.gif");
			background-repeat: no-repeat, repeat;
			background-position: center;
		}
		#p4 {
			background: url("https://foxyforex.ru/wp-content/uploads/2023/10/circle.png") center no-repeat, url("http://www.htmldog.com/examples/images/bg.gif");
		}

	</style>
</head>
<body>
	<h1><a href="https://foxyforex.ru/css/css-fony-kratnye-razmer-i-proisxozhdenie">Несколько фонов</a></h1>
	<p>Использование CSS свойств <a href="https://foxyforex.ru/css/svojstvo-css-background-image"><code>background-image</code></a> и <a href="https://foxyforex.ru/css/svojstvo-css-background"><code>background</code></a> </p>

	<pre id="p0"><code>background-image: url("bg.gif");</code></pre>
	<pre id="p1"><code>background-image: url("circle.png"), url("bg.gif");</code></pre>
	<pre id="p2"><code>background-image: url("circle.png"), url("bg.gif");</code>
<code>background-repeat: no-repeat, repeat;</code></pre>
	<pre id="p3"><code>background-image: url("circle.png"), url("bg.gif");</code>
<code>background-repeat: no-repeat, repeat;</code>
<code>background-position: center;</code></pre>
	<pre id="p4"><code>background: url("circle.png") center no-repeat, url("bg.gif");</code></pre>
</body>
</html>

Страницы в тему:

Добавить комментарий