gpt4 book ai didi

css - anchor 标签在浏览器调整大小时移动

转载 作者:行者123 更新时间:2023-11-28 12:21:38 25 4
gpt4 key购买 nike

我正在为一个类(class)做作业,当我调整浏览器大小时,我有一个移动的 anchor 标记,我希望它保持在笔图形上的位置,你会在这里看到问题:http://chrisallie.com/index.html

谢谢!

CSS:
#contact {
position: fixed;
display: block;
font-family: Century Gothic;
text-decoration: none;
text-align: center;
font-size: 18px;
font-weight: bold;
color: rgb(0, 0, 153);
transform: rotate(-77deg);
line-height: 30px;
width: 150px;
height: 20px;
margin: -300px 0px 0px 1335px;
}

HTML:
<div id="main-content">
<a href="index.html" id="home">Home</a>
<a href="index.html" id="webcoding">Web<br />Coding<br />seminar<br /><span>Don't miss!</span></a>
<a href="index.html" id="javascript">Javascript<br />10:00</a>
<a href="index.html" id="photoshop">Photoshop<br />Lesson 01 due!</a>
<a href="index.html" id="illustrator">guest speaker<br />Illustrator<br />2:00-3:00</a>
<a href="index.html" id="php">PHP<br />5:00-10:00</a>
</div>
<a href="index.html" id="contact">Drop us a line!</a>

最佳答案

把 anchor 标签移到<div id="main-content">里面

然后给出#main-content position:relative并给出 anchor position:absolute (删除所有固定定位的东西)

您现在可以相对于 #main-content 定位 anchor div,你需要给它一个负值 right但我认为在这种情况下这可能是不可避免的。

您需要调整 anchor 标记的右侧和底部(或顶部)值,但您应该能够使用上面的方法来完成。

关于css - anchor 标签在浏览器调整大小时移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13610691/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com