Как убрать пробел между абзацем и указанным списком c html - PullRequest
0 голосов
/ 25 февраля 2020

Как убрать пробел между параграфом и указанным списком c html? Основываясь на предоставленном изображении, я хочу, чтобы список был перемещен ближе к параграфе:

enter image description here

<p><strong>Reason</strong><br/>
As part of the change from the NHS, the following drugs are unable to be prescribed by the doctor and requires a special consultant to prescribe these medications:
    <ul class="nospaceabovelist">
        <li>Clonazepam</li>
        <li>Imitrex</li>
        <li>Amoxil</li>
        <li>Sensipar</li>
    </ul>
</p>

p + .nospaceabovelist li{
    margin: 0;
    padding:0;
  }

Ответы [ 3 ]

0 голосов
/ 25 февраля 2020

Я думаю, что вы ищете это :)

<html>
<head>

<style>
p
{
  margin: 0;
  padding:0;
  line-height: .75em;
}
ul
{
  margin: 0;
}

</style>
</head>
<body>
      <p><strong>Reason</strong><br/>
                As part of the change from the NHS, the following drugs are unable to be prescribed by the doctor and requires a special consultant to prescribe these medications:
                <ul>
                <li>Clonazepam</li>
                <li>Imitrex</li>
                <li>Amoxil</li>
                <li>Sensipar</li>
                </ul>
            </p>
</body>
</html>
0 голосов
/ 25 февраля 2020

Абзацы не могут содержать ul, поэтому вам нужно изменить HTML.

Затем просто удалите поля из обоих.

  p, p + .nospaceabovelist {
  margin: 0;
  padding: 0;
}
<p><strong>Reason</strong><br/> As part of the change from the NHS, the following drugs are unable to be prescribed by the doctor and requires a special consultant to prescribe these medications:</p>
<ul class="nospaceabovelist">
  <li>Clonazepam</li>
  <li>Imitrex</li>
  <li>Amoxil</li>
  <li>Sensipar</li>
</ul>
0 голосов
/ 25 февраля 2020

Добавьте это в css:

p {
    margin: 0;
}

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