How can I make a div transparent and float it over the image?


game player

I want to make the div transparent and move it over the image. Here is the sample code for html and css:

<html>
<head>
    <title></title>
    <style type="text/css">
        body {
            width: 500px;
            margin: 0 auto;
        }
        .head {
            border: 2px solid black;
            width: 346px;
            height: 50px;
        }
        h2 {
            padding: 0px;
            margin: 10px;
        }
    </style>
</head>
<body>

    <div class="wrapper">
        <div class="head">
            <h2>Logo</h2>
        </div>
        <div class="slider">
            <img src="http://placehold.it/350x150">
        </div>
    </div>

</body>
</html>

Output result:enter image description here

But I want this:enter image description here

Can someone help me? Thanks in advance:)

Nasches

provided position: absoluteto.head

So your code becomes:

body {
  width: 500px;
  margin: 0 auto;
}
.head {
  border: 2px solid black;
  width: 346px;
  height: 50px;
  position: absolute;
}
h2 {
  padding: 0px;
  margin: 10px;
}
<div class="wrapper">
  <div class="head">
    <h2>Logo</h2>
  </div>
  <div class="slider">
    <img src="http://placehold.it/350x150">
  </div>
</div>

Related


How can I make the image "float" over the button?

Roger Decker I started learning Kivy. The following code generates a 10x10 grid of buttons: from kivy.uix.gridlayout import GridLayout from kivy.app import App from kivy.uix.button import Button class MyApp(App): def build(self): layout = GridLay

How can I make the image "float" over the button?

Roger Decker I started learning Kivy. The following code generates a 10x10 grid of buttons: from kivy.uix.gridlayout import GridLayout from kivy.app import App from kivy.uix.button import Button class MyApp(App): def build(self): layout = GridLay

How can I make a sticky div float over the rest of the page?

Rodrigo: I have a floating menu at the top of the window that only occupies 1/4 of its width. The remaining 3/4 (and behind the menu 1/4) should be taken up by the image in the next document section. However, the image is initially displayed below the menu, i.

How can I make a sticky div float over the rest of the page?

Rodrigo: I have a floating menu at the top of the window that only occupies 1/4 of its width. The remaining 3/4 (and behind the menu 1/4) should be taken up by the image in the next document section. However, the image is initially displayed below the menu, i.

How can I make a sticky div float over the rest of the page?

Rodrigo: I have a floating menu at the top of the window that only occupies 1/4 of its width. The remaining 3/4 (and behind the menu 1/4) should be taken up by the image in the next document section. However, the image is initially displayed below the menu, i.

How can I make a div clickable over the entire background image?

Vignesh Pichamani I added a background image to the parent divdiv width and 100%I redirect when you click on the div (everything works), but I only want to redirect the div when you click from left to right. 100px;For example, here is a fiddle I call a div wit

How can I make a div clickable over the entire background image?

Vignesh Pichamani I added a background image to the parent divdiv width and 100%I redirect when you click on the div (everything works), but I only want to redirect the div when you click from left to right. 100px;For example, here is a fiddle I call a div wit

How can I make a div clickable over the entire background image?

Vignesh Pichamani I added a background image to the parent divdiv width and 100%I redirect when you click on the div (everything works), but I only want to redirect the div when you click from left to right. 100px;For example, here is a fiddle I call a div wit

How to make one div float over another div as this image

Fabrizio Tofanelli I've been trying everything successfully to achieve something like this This is using desktop http://i.imgur.com/mYMNxza.png This is for mobile view http://i.imgur.com/XszUTe5.png How do i do this? It would be awesome for me if Twitter Boots

How to make one div float over another div as this image

Fabrizio Tofanelli I've been trying everything successfully to achieve something like this This is using desktop http://i.imgur.com/mYMNxza.png This is for mobile view http://i.imgur.com/XszUTe5.png How do i do this? It would be awesome for me if Twitter Boots

How to make one div float over another div as this image

Fabrizio Tofanelli I've been trying everything successfully to achieve something like this This is using desktop http://i.imgur.com/mYMNxza.png This is for mobile view http://i.imgur.com/XszUTe5.png How do i do this? It would be awesome for me if Twitter Boots

How can I make the black part of the background image transparent?

Jc。 This is the result I want to achieve, as shown in the picture, the QR Code consists of black and white, but I want the black part to be transparent so that it blends with the external background. The background outside may change, but it's not always green

Float Div over image

Jeremy Harris I'm having trouble floating a div over an image. Here is what I am trying to accomplish: .container { border: 1px solid #DDDDDD; width: 200px; height: 200px; } .tag { float: left; position: relative;

Float Div over image

Jeremy Harris I'm having trouble floating a div over an image. Here is what I am trying to accomplish: .container { border: 1px solid #DDDDDD; width: 200px; height: 200px; } .tag { float: left; position: relative;

Float Div over image

Jeremy Harris I'm having trouble floating a div over an image. Here is what I am trying to accomplish: .container { border: 1px solid #DDDDDD; width: 200px; height: 200px; } .tag { float: left; position: relative;

How can I make a div float to the bottom of its container?

Stephen Martin I used float:right (or left) many times to float the image and inset on top of the container. Recently, I came across a method that required floating a div to the bottom right corner of another div, and wrapping the normal text (text that wraps

How can I make a div float to the bottom of its container?

Stephen Martin I used float:right (or left) many times to float the image and inset on top of the container. Recently, I came across a method that required floating a div to the bottom right corner of another div, and wrapping the normal text (text that wraps

How can I make a div float to the bottom of its container?

Stephen Martin I used float:right (or left) many times to float the image and inset on top of the container. Recently I came across a method that needed to float a div to the bottom right corner of another div, and use the normal text wrap (text that wraps onl