-1

I have this HTML:

  <a href="http://waterfordwhispersnews.com/2017/01/19/im-the-only-one-creating-jobs-around-here-local-drug-dealer-slams-government/#FB-Comments" class="link-preview" target="_blank" rel="nofollow">
    <div class="link-area">
      <div class="og-image">
        <a href="http://waterfordwhispersnews.com/wp-content/uploads/2017/01/grater.jpg" title="" class="fancybox" rel="article0">
          <img src="http://waterfordwhispersnews.com/wp-content/uploads/2017/01/grater.jpg">
        </a>
      </div>
      <div class="descriptions">
        <div class="og-title">
        “I’m The Only One Creating Jobs Around Here” Local Drug Dealer Slams Government
        </div>
        <div class="og-description">
          WATERFORD drug dealer Richie 'The Grater' Harrington has today slammed the Irish government for ignoring the young people in his council est…
        </div>
      </div>
    </div>
 </a>

The looks like this:

enter image description here

I'd like to add CSS to make it look more like a Facebook post, but I'm not sure where to start with this.

enter image description here

The idea is this a preview of a news post, that I would link in a blog post discussing it. This is the hexo plug-in I'm using to generate it. https://github.com/minamo173/hexo-tag-link-preview

At the very least, it needs to be boxed in. As of now, it's just inheriting the styling for links and images for a typical post.

CBroe
  • 91,630
  • 14
  • 92
  • 150
kiaraRobles
  • 587
  • 1
  • 4
  • 14

2 Answers2

1

Here is a suggestion how you can do, adding a dotted border, bigger font on the title + some padding on the anchor and the title, to make it all look good :)

And with a little trick (display: table-caption) so the text wrap and fit under the image.

I also removed the inner link a as it is not valid with nested anchors.

Stack snippet

a.link-preview {
  display: inline-block;
  border: 2px dotted black;
  padding: 5px;
}
a.link-preview .link-area {
  display: table-caption;              /*  make text wrap under image  */
}
a.link-preview .link-area .og-title {
  font-size: 22px;
  padding-bottom: 15px;
}
<a href="http://waterfordwhispersnews.com/2017/01/19/im-the-only-one-creating-jobs-around-here-local-drug-dealer-slams-government/#FB-Comments" class="link-preview" target="_blank" rel="nofollow">
  <div class="link-area">
    <div class="og-image">
        <img src="http://waterfordwhispersnews.com/wp-content/uploads/2017/01/grater.jpg">
    </div>
    <div class="descriptions">
      <div class="og-title">
        “I’m The Only One Creating Jobs Around Here” Local Drug Dealer Slams Government
      </div>
      <div class="og-description">
        WATERFORD drug dealer Richie 'The Grater' Harrington has today slammed the Irish government for ignoring the young people in his council est…
      </div>
    </div>
  </div>
</a>
Asons
  • 84,923
  • 12
  • 110
  • 165
0

I guess you are looking for a thumbnail and a caption for the image.

<div class="thumbnail">
  <a href="your_image_link.jpg">
    <img src="your_image_link.jpg">
    <div class="caption">
      <p>Lorem ipsum dolor</p>
    </div>
  </a>
</div>

Reference: https://www.w3schools.com/bootstrap/bootstrap_images.asp