JSFiddle - React, Tailwind, and code Playground
HTML
<section class="feed-section">
<article class="feed-article">
<div class="question-options">
<img src="http://placehold.it/600x400">
</div>
</article>
<article class="feed-article">
<div class="question-options">
<img src="http://placehold.it/600x400">
<img src="http://placehold.it/600x400">
<img src="http://placehold.it/600x400">
<img src="http://placehold.it/600x400">
</div>
</article>
<article class="feed-article">
<div class="question-options">
<img src="http://placehold.it/600x400">
<img src="http://placehold.it/600x400">
<img src="http://placehold.it/600x400">
</div>
</article>
</section>
JavaScript
function imagesWidth() {
var imagesConatiner = $('.question-options').each(function (index) {
var images = $(this).children('img').length;
var self = $(this);
console.log(images);
switch (images) {
case 1:
self.children('img').addClass('one')
break;
case 2:
self.children('img').addClass('two')
break;
case 3:
self.children('img').addClass('three')
break;
case 4:
self.children('img').addClass('four')
break;
default:
console.log(images)
}
})
};
imagesWidth()