Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CSS-定位伪元素_Css_Pseudo Element - Fatal编程技术网

CSS-定位伪元素

CSS-定位伪元素,css,pseudo-element,Css,Pseudo Element,我在伪元素之后定位这个有问题。如果我尝试定位它,它将不会有响应。 这就是我所拥有的: .intro>h1::after { content: ""; display: block; position: absolute; bottom: -140px; width: 100px; left: calc(50% - 50px); border-bottom: 7px solid rgba(49, 42, 96, 1); } 它在桌面上的位置正常,但在手机上的

我在伪元素之后定位这个有问题。如果我尝试定位它,它将不会有响应。 这就是我所拥有的:

.intro>h1::after {
  content: "";
  display: block;
  position: absolute;
  bottom: -140px;
  width: 100px;
  left: calc(50% - 50px);
  border-bottom: 7px solid rgba(49, 42, 96, 1);
}

它在桌面上的位置正常,但在手机上的位置不好

我如何解决这个问题,任何帮助都将不胜感激。 谢谢。

像这样试试

.intro>h1::after {
    content: "";
    display: block;
    position: absolute;
    bottom: -10px;
    width: 100px;
    left: 0;
    right: 0;
    margin-right: auto;
    margin-left: auto;
    border-bottom: 7px solid rgba(49, 42, 96, 1);
}
h1{
    position: relative;
    display: inline-block;
}
这对我有用

.intro>h1::after {
  content: "";
  display: block;
  position: relative;
  bottom: -20px;
  width: 100px;
  margin: 0px auto;
  border-bottom: 7px solid rgba(49, 42, 96, 1);
}

杰弗里德!请提供完整的代码或演示链接欢迎使用堆栈溢出。我们是一个传统的、由社区驱动的问答平台,致力于以a的形式提供包括a在内的内容。您能否提供演示链接?我们在哪里可以了解您在猜测中的实际工作。OP,请继续阅读上面评论中提供的链接,并为下一个问题提供答案。干杯。是的,这是一个猜测@domdom完成的。所以下次请提供一个片段。@o.danielcoker