css - 链接重叠问题

标签 css

链接互相覆盖,截图为:enter image description here

我使用的 CSS 是:

.moderation_buttons a:link, .moderation_buttons a:active, .moderation_buttons a:visited{
padding: 1px 9px;
background: #d6d6d6;
color: #000;
margin: 3px;
text-decoration: none;}

如果有人想查看这些链接的 HTML,这里是 HTML:

// Working on the Moderation Buttons
$view_profile = '<a href="index.php?action=profile_student&amp;sid='.$sid.'">VIEW PROFILE</a>';
$edit = '<a href="index.php?action=edit_student&amp;sid='.$sid.'">EDIT</a>';
$delete = '<a href="index.php?action=delete_student&amp;sid='.$sid.'">DELETE</a>';
$cancel = '<a href="index.php?action=cancel_student&amp;sid='.$sid.'">CANCELATION</a>';
$admission_form = '<a href="index.php?action=cancel_student&amp;sid='.$sid.'">ADMISSION FORM</a>';
$promote = '<a href="index.php?action=promote_student&amp;sid='.$sid.'">PROMOTE</a>';
$fee = '<a href="index.php?action=fee_print_student&amp;sid='.$sid.'">FEEs</a>';

$moderation_buttons = '<div class="moderation_buttons">'.$view_profile.$edit.$delete.$cancel.$admission_form.$promote.$fee.'</div>';

我该如何调整它,以便正确调整链接并且不会相互覆盖?

谢谢

最佳答案

设置

.moderation_buttons a{ display: inline-block }

anchor 标记不是 block 元素,这就是填充没有被添加到 anchor 标记的原因。为此,您应该将其设为 block 级元素。但是,由于您也希望内嵌它,因此请使用 display: inline-block 样式。

关于css - 链接重叠问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39831667/

相关文章:

css - 圆形悬停效果缩放以填充 div 到 100%

css - Google Chrome 上未显示特定的 Web 字体

html - 加载 gif 时主屏幕保持灰色

php - 更新、删除、编辑数据

html - div 属性的行为

html - 如何右对齐表单输入框?

javascript - CSS 类不适用于 html

html - CSS 线性渐变显示为不同颜色的交替线

html - 如何在 CSS 中用垂直线分隔的字形和列列表?

javascript - IE8 中空 div 层的 z-index 问题