Я пытаюсь установить фоновое изображение НЕ используя CSS.Как я могу установить его в HTML-документе, когда содержимое отображается поверх изображения?
Я хочу, чтобы изображение реагировало на изменение ширины браузера.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Rapid Weather</title>
<link rel = "stylesheet" href = "style.css" />
</head>
<body>
<img src="images/sunny.png" alt="sunny picture" class="img">
<section id = "weather-wrapper" class = "container-fluid">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div id = "weather-info">
<span id = "temperature"></span><span id="unit">°C</span><br><br>
<p id = "city"></p>
<p id = "climate"></p>
<img id = "icon" />
</div>
<div id="error-info">
<h1><span class="fa fa-warning"></span><span id="err-msg"> City not found</span></h1>
</div>
</div>
</div>
</section>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src = "script.js"></script>
</body>
</html>
Когда я установил изображение, теперь содержимое находится под изображением, и я не могу заставить изображение идти позадиотображение сценария.Я не могу использовать селектор тела в CSS, потому что он изменяет остальную часть отображаемого содержимого.
@import url('https://fonts.googleapis.com/css?family=Anton|Mogra|Lobster|Josefin+Sans');
body {
color: #ffffff;
}
img {
max-height: 100%;
max-width: 100%;
}
a {
text-decoration: none;
color: #616161;
transition: linear 0.3s;
}
a:hover {
text-decoration: none;
color: #fafafa;
}
#weather-wrapper, #error-info {
transform: translateY(80px);
text-align: center;
}
#temperature-wrapper {
border: solid 1px #212121;
border-radius: 100%;
}
#error-info, #weather-info {
display: none;
}
#title {
font-size: 55px;
font-family: 'Lobster', cursive;
}
#search, #weather-info {
margin-top: 40px;
}
#city, #temperature, #search input, #unit, #climate, #err-msg {
font-family: 'Josefin Sans', sans-serif;
}
#city, #climate {
font-size: 25px;
text-transform: capitalize;
}
#temperature, #unit {
font-size: 40px;
}
#search {
position: relative;
}
#search input {
text-indent: 30px;
height: 50px !important;
border-radius: 0;
font-size: 20px;
color: #000000;
}
#search .fa-search {
color: grey;
position: absolute;
top: 17px;
left: 17px;
font-size: 15px;
}
#unit {
transition: linear 0.2s;
}
#unit:hover {
cursor: pointer;
color: #ff4436;
}