html - 如何在 html 中内联 p 和 a 标签?

标签 html css inline display

我正在尝试放置一个 <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>

最佳答案

  1. 在您的 HTML 中,尝试在您希望它显示的任何文本后直接键入或

例如:<div>When i came<a> ut yiur name</a>so what do i do</div>

  1. 在您的 CSS 正文中,尝试内联 block 或仅使用 DISPLAY 属性内联参数,以将任何图像或文本放入一行的正常流中。

例如:

一个{display:inline-block;}

关于html - 如何在 html 中内联 p 和 a 标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46499328/

相关文章:

haskell - 内部模块的跨模块内联

html - 我的输入标签不会与我的输入类型 = 文本对齐

javascript - 用 HTML/CSS/Javascript 或 w Jquery 编写的响应式图像/横幅也是可扩展的

css - 子边框低于父边框

html - 修复了 TwitterBootstrap 2.3.5 的侧边栏

css - 删除 MS-bot 框架中的图片上传按钮

types - F#中自然数的类型级编码

html - Css 在压缩模式下不工作

html - Angular DomSanitizer : Sanitizing Mask-Image Not Working

html - 无法让 div 显示内联