英文:
How to put a line under a word and controle marging of an element CSS
问题
I can help you with the translation. Here are the translated parts:
第一个问题,我想控制单词下的线的宽度,请问如何实现这个效果,请告诉我,
在此输入图像描述
我尝试使用 text-decoration: underline;
,但它给整个单词下面加了一条线。
第二个问题,我想将一个容器放在另一个容器上面,第一个容器带有一张图片,第二个容器带有一个表单。当我在平板电脑上打开时:
在此输入图像描述
它显示了预期的结果,但在浏览器中打开时:
在此输入图像描述
如您所见,图像被推到了左侧。我想要的是,无论如何,都希望图像始终显示在屏幕的右侧,就像这样:
在此输入图像描述
第一个容器的CSS样式:
background: #F8F8F8;
margin-right: 40px;
padding: 35px;
position: relative;
z-index: 999;
包含图像的容器的CSS样式:
height: 350px;
position: absolute;
z-index: 1;
希望这些翻译对您有帮助。如果您有其他问题,请随时提出。
英文:
I'm facing two issues please,
first I want to controle width of a line under a word, could you tell me please how can I achieve this result please,
enter image description here
I tries to put text-decoration: underline;
but it gives a line under the whole word.
the second problem, I want to put a container over a container, the first one with an image and the second one with a form, when I open in:
tablette :
enter image description here
it gives the expected result, but when I open in the browser it gives this :
enter image description here
as you see the image is pushed on the left.
what I'm looking for , is I want the image to be displayed always at the right of the screen like this :
enter image description here
css of the first container :
background: #F8F8F8;
margin-right: 40px;
padding: 35px;
position: relative;
z-index: 999;
css of the container contains the image :
height: 350px;
position: absolute;
z-index: 1;
css of the first container :
background: #F8F8F8;
margin-right: 40px;
padding: 35px;
position: relative;
z-index: 999;
css of the container contains the image :
height: 350px;
position: absolute;
z-index: 1;
答案1
得分: 0
For the first thing:
HTML:
<span class="underlined-text">创建您的公司</span>
CSS:
.underlined-text {
position: relative;
display: inline-block;
}
.underlined-text::after {
content: '';
position: absolute;
bottom: -3px;
left: 0;
display: block;
height: 2px;
background-color: black;
width: 100%; /* 更改此处以实现您想要的效果 */
}
As for your second problem, I don't really get what's the problem but one possible solution is specifying a width for divs. This will make sure that the divs don't take all available space.
英文:
For the first thing:
HTML:
<span class="underlined-text">Creez Vorte Compe</span>
CSS:
.underlined-text {
position: relative;
display: inline-block;
}
.underlined-text::after {
content: '';
position: absolute;
bottom: -3px;
left: 0;
display: block;
height: 2px;
background-color: black;
width: 100%; /* Change this to achieve what you want to achieve */
}
As for your second problem, I don't really get what's the problem but one possible solution is specifying a width for divs. This will make sure that the divs don't take all available space.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论