Images in P tags?

Yes, it is OK, if the text equivalent (the value of the alt attribute) makes sense at that place in the paragraph.

Example 1


<p>If there is a known issue with the service, you will see a
<img src="/img/warning.png" alt="Warning!"> icon
in the upper right-hand corner.</p>

Example 2


<p><img src="/img/alert.png" alt="Notice! This service is temporarily out of order."></p>

If the text equivalent is empty, e.g., for a purely decorative image, it's better to use a <div>.

Example 3


<div><img src="/img/sunset.jpg" alt=""></div>

Remember: an image is nothing but an alternative representation of the information in the text equivalent (semantically). Therefore an image can be used wherever the corresponding text equivalent can be used.

Источник: sitepoint.com/community/t/images-in-p-tags/5943/2

Теги: DIV, HTML, IMG, P, Семантика

  • Опубликовано: 23 Января, 2023
  • Последнее редактирование: 3 Февраля, 2023
Яндекс.Директ Google AdWords Bing Ads Amazon Product Ads HTML CSS JavaScript jQuery PHP CMS CMF MODX Wordpress Drupal ExpressionEngine htaccess SEO SEM HTML CSS JavaScript jQuery PHP CMS CMF MODX Wordpress Drupal ExpressionEngine htaccess SEO SEM Яндекс.Директ Google AdWords Bing Ads Amazon Product Ads