wesley Posted March 28, 2017 Share Posted March 28, 2017 Hello, I select data from a database in a while loop. But I want to style the data with CSS. my question is: How can I make this like the uploaded image example? my code is: echo "<div>"; while ($record = mysqli_fetch_assoc($result)) { $id = $record ['foto_id']; $titel = $record['titel']; $img = $record['img_thumb']; echo "<h3>$titel</h3>"; echo "<h4>Beoordelingen</h4>"; echo "$id"; echo "<img src='$img' alt='image'> "; echo "<div>"; echo "Beoordeling: <input type='text' name='beoordeling' maxlength='4' size='4'/> (Ja/Nee of ?) <br />"; echo "Commentaar: <textarea rows='4' cols='25'></textarea>"; echo "Commentaar: <textarea rows='4' cols='25'></textarea>"; echo "Commentaar: <textarea rows='4' cols='25'></textarea>"; echo "Commentaar: <textarea rows='4' cols='25'></textarea>"; } echo "</div>"; echo "</div>"; thanks in advance Link to comment Share on other sites More sharing options...
davej Posted March 28, 2017 Share Posted March 28, 2017 The only consideration that the loop introduces is the need for a styling approach that will accept a varying number of these div blocks. Link to comment Share on other sites More sharing options...
dsonesuk Posted March 29, 2017 Share Posted March 29, 2017 (edited) From what I see, you require the loop to create four independent containers, therefore you require current opening divs inside the loop, with single textarea, then single opening closing div outside to envelope the indepent containers. By applying id or class to outer container OR class (as they are multiple) to outer independent container you then are able to reference child elements for styling. Edited March 29, 2017 by dsonesuk Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now