Как разместить текст, кнопки и т. Д. c внутри картинки - PullRequest
0 голосов
/ 26 апреля 2020

Я хочу вставить код в изображение, но мне не удалось. В чем проблема? Я использую Microsoft Word Word Web 4.0. Как разместить текст, кнопки и т. Д. c внутри картинки?

<form action="mailto:someone@example.com" method="post" enctype="text/plain">
  Name:<br />
  <input type="text" name="name" /><br />
  E-mail:<br />
  <input type="text" name="mail" /><img
    alt=""
    height="724"
    src="email-client-market-share-2019-blog.png"
    width="1380"
  /><br />
  Comment:<br />
  <input type="text" name="comment" size="50" /><br /><br />
  <input type="submit" value="Send" />
  <input type="reset" value="Reset" />
</form>

Ответы [ 2 ]

0 голосов
/ 26 апреля 2020

обратитесь к этому коду и посмотрите, работает ли он для вас, сохраните этот код в качестве индекса. html и запустите браузер, чтобы увидеть результат !!

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.container {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.container img {
  width: 100%;
  height: auto;
}

.container .btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  background-color: #555;
  color: white;
  font-size: 16px;
  padding: 12px 24px;
  border: none;
  cursor: pointer;
  border-radius: 5px;
  text-align: center;
}

.container .btn:hover {
  background-color: black;
}
</style>
</head>
<body>

<h2>Button on Image</h2>
<p>Add a button to an image:</p>

<div class="container">
  <img src="img_snow.jpg" alt="Snow" style="width:100%">
  <button class="btn">Button</button>
</div>

</body>
</html>

Надеюсь, это поможет !!

0 голосов
/ 26 апреля 2020

Вы можете использовать z-index в CSS, чтобы сделать это. Поместите изображение на z-index: 1; и элементы, которые вы хотите поместить поверх него, на z-index: '>1';.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...