javascript - How to insert an advertisement at the top of the page without destroying the page layout (without affecting the content below)?
我想大声告诉你
我想大声告诉你 2017-07-05 10:40:45
0
4
1062

is a long advertisement at the top, pushing down other content. Directly inserting a p img will not work, as it will cause the underlying content to be misaligned or cover up. Can it be solved using js/jquery?

我想大声告诉你
我想大声告诉你

reply all(4)
三叔

Wrap it with a p

<p><img src="xxx" /></p>

小葫芦

Generally, advertisements on web pages are a piece of js code. It is easier to place ads in this way. The function of the js code is to request materials, create dom elements, adjust the layout, and handle the display and click logic. If the line is troublesome, you can directly set an iframe.

女神的闺蜜爱上我

If the ad space is 100% wide and 200px high

body{
    margin-top : 200px;
}

.banner{
    position : fixed;
    width:100%;
    height:200px;
    top:0;
    left:0;
}
黄舟

To prevent the content below from being misaligned or covered, you can just create a translucent overlay advertisement. Use pointer-events:none and apply pointer-events:none to the translucent overlay element. The content behind the translucent overlay can be seen. Get it, you can also perform click events
For details, please refer to the master
http://www.zhangxinxu.com/stu...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template