JSFiddle - React, Tailwind, and code Playground
HTML
<div class="main">
<div class="photo"></div><div class="info"></div>
</div>
<div class="main">
<div id="info"></div>
</div>
CSS
.main{
display:block;
color:red;
width:200px;
height:200px;
}
.photo{
float:left;
width:50%;
display:block;
background:red;
height:100%;
}
#info{
float:left;
width:50%;
display:block;
background:red;
height:100%;
}
JavaScript
$(document).ready(function() {
//check if photo div exists
$( ".main" ).each(function( index ) {
var thisPhoto = $(this).find('.photo').html();
if(thisPhoto==undefined){
$(this).find('#info').css('width', '100%');
}
});
});