如何显示两个内联<span>?

时间:2018-09-26 21:03:50

标签: html css

<div class="wrap-input100 validate-input  mr-3">
  <input type="text" name="title" class="input100 text1" autocomplete="off" required>

  <span class="focus-input100" data-placeholder="Title"></span>
  <span class="count1 text-secondary"></span>

</div>

我需要同时显示两个span内联。 display-inline: flex;似乎无效。

我有一个CSS是我从网站上下载的,用于对输入内容进行样式化,CSS确实很大,所以我无法在此处显示摘录内容。

链接到codepen:https://codepen.io/user236945896/pen/yRBLPM

2 个答案:

答案 0 :(得分:1)

我希望这是您想要的,因为您的问题还不清楚。

<div class="wrap-input100 validate-input  mr-3">
  <input type="text" name="title" style="display:inline-block;width:auto;" class="input100 text1" autocomplete="off" required>

    <span class="focus-input100" style="width:auto" data-placeholder="Title"></span>
    <span class="count1 text-secondary"></span>

</div>

链接到codepen:https://codepen.io/anon/pen/NOKWmb

答案 1 :(得分:0)

您已经尝试过类似的方法吗?运行此代码,看看是否有帮助。

<!DOCTYPE html>
<html>
<head>
<style>
span.a {
    display: inline; /* the default for span */
    padding: 5px;
    border: 1px solid blue;    
    background-color: yellow; 
}

span.b {
    display: inline-block;    
    padding: 5px;
    border: 1px solid blue;        
    background-color: yellow; 
}

span.c {
    display: block;    
    padding: 5px;
    border: 1px solid blue;        
    background-color: yellow; 
}
</style>
</head>
<body>

<h1>The display Property</h1>

<h2>display: inline</h2>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat scelerisque elit sit amet consequat. Aliquam erat volutpat. <span class="a">Aliquam</span> <span class="a">venenatis</span> gravida nisl sit amet facilisis. Nullam cursus fermentum velit sed laoreet. </div>

<h2>display: inline-block</h2>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat scelerisque elit sit amet consequat. Aliquam erat volutpat. <span class="b">Aliquam</span> <span class="b">venenatis</span> gravida nisl sit amet facilisis. Nullam cursus fermentum velit sed laoreet. </div>

<h2>display: block</h2>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum consequat scelerisque elit sit amet consequat. Aliquam erat volutpat. <span class="c">Aliquam</span> <span class="c">venenatis</span> gravida nisl sit amet facilisis. Nullam cursus fermentum velit sed laoreet. </div>

</body>
</html>