In my HTML page I have a list of dynamic services from database, I just want to display a list of names of those services in at least two lines.
If the name of the service has two words then the first word in the first line and the second word in the second line. If the name has three words then the first two words in the first line and the third word in the second line. But if the name of the service has three words, then it will be adjusted vertically in two lines, but it will not be in three lines.
i want as shown in the picture below. So help me with that. The solution will run in any language, CSS or JS.
But it is not working in my code, I tried with the following code.
$list = {
"CM" : "Classic Manicure",
"CU" : "Clean Up",
"FCUS" : "Face Clean Up Full Tool Set",
"FFW" : "Full Face Waxing",
"FR" : "Foot Reflexology",
"KM" : "Kids Manicure",
"FCU" : "Face Clean Up",
"GFTK" : "Gel French Tool kit",
};
$(document).ready(function(){
$.each($list, function(key, name){
html = '<div class="col">\
<div>\
<span class="letter">'+ key +'</span>\
<div class="name">'+ name +'</div>\
</div>\
</div>';
$('.list').append(html);
});
});
*, ::after, ::before {
box-sizing: border-box;
}
.container{
max-width: 500px;
margin: 0 auto;
}
.row{
width: 100%;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
}
.col {
-ms-flex: 0 0 33.333333%;
flex: 0 0 24%;
max-width: 24%;
margin: 1% .5%;
border: 1px solid #999;
border-radius: 5px;
padding: 25px 5px;
text-align: center;
box-shadow: 1px 1px 2px #ddd;
}
span.letter {
margin: 5px 0;
display: inline-block;
font-size: 25px;
font-weight: bold;
font-family: cursive;
text-shadow: 1px 1px 1px white, 2px 2px 1px red;
}
.name {
margin-top: 5px;
font-size: 16px;
color: #666;
}
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<div class="container">
<div class="row list"></div>
</div>
Up" and "Gel French Tool kit" (should be "Gel French
Tool kit". – matthias_h Apr 24 '20 at 16:22
lke this in all name. – Bhavik Hirani Apr 25 '20 at 04:10