How HTML adds content to a picture
Demo effect
One of the most recent effects is that the page has a big picture on the head, and the menu bar floats over the picture. I see the Internet is very simple, the general principle is that the picture is defined as relative positioning, the text is defined as absolute positioning can be. But I didn't do well and it took me hours to get the menu bar floating in the picture. Here is the effect chart. first of all, Cloth Bureau:
Notice that the menu bar and text are not above the picture, and the background color I set for the menu bar is translucent black, which, if it floats successfully on top of the picture, is translucent.
Now for pictures and text boxes. IMGW Add position attributes: Position:relative (relative positioning)
The box for the text. Words add: position:absolute; (absolute positioning)
Also add to menu bar nav: Position:absolute (absolute positioning)
These three positions are important.
This effect is as follows:
After positioning, you can see the menu bar is gone, the text is not floating in the picture. Don't worry, the menu bar is just covered, now set z-index:10 for the menu bar,
The text sets the distance top:50% for it, the distance left:30%.
Here is the complete code:
<! DOCTYPE html>