【问题标题】:How to show the breadcrumbs in a single line in wordpress?如何在wordpress中单行显示面包屑?
【发布时间】:2021-01-05 11:30:26
【问题描述】:

我在 php 中有一个代码来显示它像这样输出的面包屑

the link i found the php code
输出
<div id="crumbs"><a href="http://localhost">Home</a> » <a href="http://localhost/about/">About The Tests</a> » <span class="current">Page Image Alignment</span></div>

它看起来像这样

#crumbs a,
#crumbs span {
    border-radius: 0px 10px 10px 0px;
    box-shadow: -3px 2px 18px -3px #000;
    background: #4489ff;
    width: max-content;
    display: inline-block;
    color: white;
    font-size: 17px;
    padding: 6px;
    font-weight: bolder;
    margin-left: -1px;
    margin-top: 1rem;
    text-decoration: none;
}

#crumbs span.current{
  background: #eef5ff !important;
  color: black !important;
}
<center>
<!-- Do Not use <center> tag ! !-->


<div id="crumbs"><a href="http://localhost">Home</a>  <a href="http://localhost/about/">About The Tests</a>  <span class="current">Page Image Alignment</span></div>


<!-- Do Not use </center> tag ! !-->
</center>

我想把面包屑做成单行并且喜欢这样。 我已经完成了 90%,但我不知道如何像图像一样显示盒子阴影

请告诉我怎么做。 感谢您的帮助

图片桌面

图片手机

【问题讨论】:

  • 这只是您尚未在此处发布的样式...您正在寻找浮动、边框半径和框阴影。应该就是这些了。
  • 请告诉我如何评价你的评论
  • 可能类似于 #crumbs a {border-radius-right: 50%; box-shadow: 3px 3px 6px #787878; background: #0000FF; text: #fff; float: left; 和活动页面跨度反向背景和文本颜色
  • 代码看起来仍然不错,但我需要完全一样,我也需要它居中对齐,但我赞成你的评论谢谢朋友
  • @QuestionsBoy 您需要通过在编辑器中使用 sn-p 提供一个最小的可重现示例。这样我或其他人就可以修复代码中不起作用的问题。 stackoverflow.com/help/minimal-reproducible-example

标签: html css wordpress breadcrumbs


【解决方案1】:

编辑:我删除了绝对定位方法,将其居中并使其具有响应性。

.crumbswrapper {text-align: center;}
#crumbs {
  text-align: left;
  display: inline-block;
  font-family: roboto;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 12px;
}
.innerwrap {
  display: inline-block;
  background:#4489ff;
  padding-right: 10px;
  margin: 0 0 0 -5px;
}
.innerwrap:last-child {
  background: none;
}
.innerwrap:nth-last-child(2) {
  background: #eef5ff;
}
#crumbs a, #crumbs span {
  background:#4489ff;
  border-radius: 0 20px 20px 0;
  box-shadow: 5px 0 10px -4px #444;
  color: white;
  padding: 10px 25px 10px 20px;
  text-decoration: none;
  white-space: nowrap;
  line-height: 34px;
}
.innerwrap:nth-last-child(2) a {
  box-shadow: none!important;
}

#crumbs span.current{
  background: #eef5ff !important;
  box-shadow: none!important;
  white-space: nowrap;
  color: #4489ff!important; 
}
<div class="crumbswrapper">
  <div id="crumbs">
    <div class="innerwrap"><a href="http://localhost">Home</a></div>
    <div class="innerwrap"><a href="http://localhost/about/">About The Tests</a></div>
    <div class="innerwrap"><span class="current">Page Image Alignment</span></div>
  </div>
</div>

【讨论】:

  • 看起来很不错!但是你能不能让它响应式和中心化它在桌面上很好,但在移动设备上不行
  • 你可以发送响应式示例的屏幕截图吗?我想看看它是如何崩溃的
  • @QuestionsBoy 我让它响应并居中 crumbs div
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-07-01
  • 1970-01-01
相关资源
最近更新 更多