0

I am trying to figure out the best way to create this: enter image description here

The black square represents small icons, and there is heading and paragraph of that certain section. The icons should be aligned to the heading. The paragraph should be just underneath the heading.

7
  • 1
    What have you tried so far? You can simply use pure css to do that... Commented Mar 7, 2017 at 10:32
  • You can use bootstrap columns to get the 3 column per row structure. Commented Mar 7, 2017 at 10:33
  • Flexbox, but the paragraph is not aligned under heading..it is just under Commented Mar 7, 2017 at 10:33
  • Show us your code please, then we can help you Commented Mar 7, 2017 at 10:34
  • Bootstrap would be a nice solution indeed.. its up to you ! it may be a bit complicated for nothing but then would help you design the rest of your website easily aswell Commented Mar 7, 2017 at 10:34

2 Answers 2

1

I would use absolute positioned icons with a negative margin and float for the 3 columns with a width of 33.33%.

HTML:

<div class="row">
  <div class="col"><img src="" /><h2>Heading</h2><p>Paragraph</p></div>
  <div class="col"><img src="" /><h2>Heading</h2><p>Paragraph</p></div>
  <div class="col"><img src="" /><h2>Heading</h2><p>Paragraph</p></div>
</div>

CSS:

* {box-sizing: border-box;}
.row {overflow: auto;}
.col {width: 33.33%; float: left; padding-left: 100px;}
.col img {position: absolute; width: 80px; margin-left: -100px;}

@media (max-width: 991px) {.col {width: 100%;}}

Here a working demo: http://codepen.io/anon/pen/bqBNeL

Sign up to request clarification or add additional context in comments.

1 Comment

Please suggest flexbox here... ;-)
0

If you're just displaying icons, I would not use an image tag at all as they are not "content" per-se. I'd be using background images.

ul {
  list-style: none;
  padding: 0;
}

li {
  background-repeat: no-repeat;
  float: left;

  /*Adjust the below lines based on your icon size*/
  padding-left: 55px;
  width: calc(33% - 55px);
  
}

h2 {
  /*Adjust the below lines based on your icon size and aligning requirements*/
  margin-top: 12px;
  margin-bottom: 25px;
}

.bill {
  background-image: url(http://fillmurray.com/50/50);
}

.city {
  background-image: url(http://lorempixel.com/output/city-q-c-50-50-7.jpg);
}

.cat {
  background-image: url(http://lorempixel.com/output/cats-q-c-50-50-7.jpg);
}

.food {
  background-image: url(http://lorempixel.com/output/food-q-c-50-50-7.jpg);
}

.sports {
  background-image: url(http://lorempixel.com/output/sports-q-c-50-50-7.jpg);
}
<ul>
  <li class="bill">
    <h2>Bill Murray</h2>
    <p>Some Para</p>
  </li>
  <li class="city">
    <h2>City</h2>
    <p>Some Para</p>
  </li>
  <li class="cat">
    <h2>Cat</h2>
    <p>Some Para</p>
  </li>
  <li class="food">
    <h2>F00d</h2>
    <p>Some Para</p>
  </li>
  <li class="sports">
    <h2>Sports</h2>
    <p>Some Para</p>
  </li>
  <li class="bill">
    <h2>Bill Murray</h2>
    <p>Some Para</p>
  </li>
  <li class="cat">
    <h2>Cat</h2>
    <p>Some Para</p>
  </li>
</ul>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.