html导航栏悬浮在最右边

html导航栏悬浮在最右边,第1张

首先给导航栏来个float:right即可。

2、其次在html中,右边图片的代码是“imgalign=right”。“对齐”属性用于设置图片元素相对于其他元素的方向。

3、最后当属性值为“右”时,图片元素将显示在右侧。

用 CSS 的 fixed 属性值,示例:

.infoWin {

    position: fixed

    right: 10px

    bottom: 10px

    width: 200px

    height: 120px

}

上述代码会让 .infoWin 这个元素固定悬浮在页面右下方。

做到比较简单

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/htmlcharset=utf-8" />

<title>无标题文档</title>

<style type="text/css">

#apDiv1 {

position:absolute

width:200px

height:115px

z-index:1

background-color:#CCC

left: 165px

top: 211px

display:none

}

</style>

<script type="text/javascript">

function a(){

var a=document.getElementById("a").value

if(a=="tijiao"){

document.getElementById("apDiv1").style.display="block"

}

}

</script>

</head>

<body>

<input type="button" value="tijiao" id="a" onclick="a()" />

<div id="apDiv1">hello</div>

</body>

</html>


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/6209570.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-18
下一篇 2023-03-18

发表评论

登录后才能评论

评论列表(0条)

保存