我正在尝试放置一个 <p>
标签内嵌 <a>
标签,但我无法弄清楚如何。我在 css 中尝试了几种显示类型,但它们要么不起作用,要么对它做了一些奇怪的事情。
(这里有一堆不必要的词,因为事情是说代码太多,词不够。我认为这很愚蠢,因为我说的已经足够了,除非有人特别询问某事的细节)。
下面是一些示例代码:
body {
margin: 0;
padding: 0;
background-color: #efefef;
}
header {
margin: 0;
margin-top: -10px;
background-color: #ffffff;
}
header p {
margin: 0;
font-family: "arial";
font-size: 50px;
color: #3c3c3c;
margin-top: 10px;
margin-left: 10px;
text-align: center;
}
header a {
}
#information {
width: 500px;
height: 250px;
background-color: #ffffff;
box-shadow: 7px 7px 4px grey;
margin-left: 100px;
margin-top: 150px;
}
#information p {
font-family: "arial";
font-size: 20px;
color: #1febff;
}
#delete {
margin-top: 2000px;
}
<!DOCTYPE html>
<html>
<head>
<title>SaHa | Color Scheme</title>
<link href="style.css" type="text/css" rel="stylesheet" />
</head>
<body>
<header>
<p>SaHa</p>
<a href="#">Menu</a>
</header>
<div id="information">
<p>Pretend that there is a bunch of important information here even though there really isn't.
This is normally where a message that actually means something would go, but this is just a
placeholder because I have nothing important to put here right now.
</p>
</div>
<div id="delete"></div>
</body>
</html>
最佳答案
- 在您的 HTML 中,尝试在您希望它显示的任何文本后直接键入或
。
例如:<div>When i came<a> ut yiur name</a>so what do i do</div>
- 在您的 CSS 正文中,尝试内联 block 或仅使用 DISPLAY 属性内联参数,以将任何图像或文本放入一行的正常流中。
例如:
一个{display:inline-block;}
关于html - 如何在 html 中内联 p 和 a 标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46499328/