如何使用 CSS 将链接在盒子内相互对齐?
我的目标是制作一个 DIV,在 hover
上显示最新的四个新闻链接,并带有标题和小图片。
该框将很小(150 像素高 x 50 像素宽),并将扩展到大约 500 像素。单击一篇文章后,它将弹出一个您可以退出的框。该框将在其余内容上放置一个深色层,以便用户集中注意力。
无论如何...这是我目前拥有的CSS。
#news {
position: fixed;
top: 250px;
left:0px;
background-color: blue;
min-width: 20px;
max-width: 600px;
height: 200px;
}
#news a {
display: none;
padding-bottom: 5px;
color: white;
}
#news:hover {
display: block;
padding: 0px 10px 0px 0px;
}
#news:hover a {
display: block;
}
我的 HTML 使用 a
标签来编辑位置,但是想知道是否有人对如何使 div 内的框看起来整洁并符合我的命令有任何建议?
My goal is to make a DIV that presents the latest four news links with the title and a small picture on hover
.
The box will be small (150px height by 50px width) and will expand to about 500px. Once an article is clicked, it will bring up a box that you may exit out of. This box will put a dark layer on the rest of the content so that it is focused on by the user.
Anyways... here is my CSS I have currently.
#news {
position: fixed;
top: 250px;
left:0px;
background-color: blue;
min-width: 20px;
max-width: 600px;
height: 200px;
}
#news a {
display: none;
padding-bottom: 5px;
color: white;
}
#news:hover {
display: block;
padding: 0px 10px 0px 0px;
}
#news:hover a {
display: block;
}
My HTML uses the a
tag to edit the position, but was wondering if anyone had any suggestions on how to go about making the boxes inside the div look neat and conform to my command?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你正在寻找这样的东西:
那么你的风格将是这样的:
等等......
I think you're looking for something like this:
Then your styles would be something like this:
Etc...