HTML-★★★格式与布局fixed/absolute/relative/z-index/float★★★

    很多网页都存在一个悬浮的操作条或者广告区,无论如何上下滚动网页,操作条或广告区都不会动,这个就是div制作,位置锁定在屏幕指定位置,现在我们就学习下网页的格式与布局。

 

position 位置,来给div定位

1、position:fixed;锁定位置(相当于浏览器窗口的位置),默认层数最高。例如有些网站的右下角弹窗。

练习:在右下角做一个弹窗,锁定位置,不随网页滚动而滚动。

步骤:

一、先做一个文字的弹窗

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>格式与布局</title>
<style type="text/css">
.wtc
{
    width:200px; height:150px; background-color:#F00;
    border:yellow solid 6px;
    line-height:150px; text-align:center;
}
</style>
</head>

<body>
<div class="wtc"><b><u>Welcom To China!</u></b></div>
</body>
</html>
welcome to china

相关文章:

  • 2021-12-06
  • 2021-11-07
  • 2022-02-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-11
相关资源
相似解决方案