如何在 HTML 中创建一个矩形并在其上放置一些文本?

How to create a rectangle in HTML and put some text on it?

我想在 html 中创建一个矩形并在其上放置一些文本。 当点击那个矩形时,它应该重定向到另一个页面.. 有什么指点吗?

您应该使用带有显示设置的标签:

a {
  display: inline-block;
  height: 50px; /*sets height of element*/
  background: cornflowerblue; /*sets the background of this element (here a solid colour)*/
  transition: all 0.6s; /*sets a transition (for hover effect)*/
  padding-left: 20px; /*sets 'padding'*/
  padding-right: 20px; /*sets 'padding'*/
  line-height: 50px; /*for this, it sets vertical alignment*/
}
a:hover {
  background: tomato; /*sets background colour*/
}
<a href="#">Some Text</a>

在您的 href 属性中,您应该将 link 放置到您的下一页:

<a href="/Home/NextPageDirectory">Link Text</a>