<html> <head> <style type="text/css"> img { float:left; } </style> <script type="text/javascript"> function clearLeft() { document.getElementById("p1").style.clear="left"; } </script> </head> <body> <img src="/static/images/beatles.jpg" /> <p id="p1">This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text.</p> <input type="button" onclick="clearLeft()" value="Clear left side of text" /> </body> </html>
结果:
编辑上面的代码,点击查看结果。
yige.org
- 试一个