Formatting html object to make card using css -
so i'm working on project , i'm having trouble css/formatting since i've never heavily used css before.
below code snippet. in snippet text kinda far below image. need same height image , have same line spacing between lines (right bettween bold text , regular text there large space) prevent text wrapping under image.
see link example of how need css make look.
i'm not sure how , appreciated.
<head> <style> * { box-sizing: border-box; } #myinput { background-image: url('/css/searchicon.png'); background-position: 10px 12px; background-repeat: no-repeat; width: 100%; font-size: 16px; padding: 12px 20px 12px 40px; border: 1px solid #ddd; margin-bottom: 12px; } #myul { list-style-type: none; padding: 0; margin: 0; } #myul li { /*border: 1px solid #ddd;*/ /* not needed @ point */ /*margin-top: -1px; */ /* prevent double borders: not needed @ point */ background-color: #8a0707; padding: 12px; text-decoration: none; font-size: 18px; color: black; display: block } #myul li a:hover:not(.header) { background-color: #eee; } /*******************************************/ li { width: 30%; min-height: 5em; padding: 1.5em; border: 1px solid #000; display: -moz-inline-stack; display: inline-block; vertical-align: top; margin: 5px; zoom: 1; *display: inline; _height: 250px; } /*******************************************/ /*these attributes work if object div chip class*/ /*.chip { display: inline-block; padding: 0 25px; height: 50px; font-size: 16px; line-height: 50px; border-radius: 25px; background-color: #f1f1f1; } */ .chip img { float: left; /* moves chip image particular side */ margin: -1.5em .5em 2em 0em; /*moves image down ,moves text next image rightwards,moves image up, moves image right*/ height: 50px; width: 50px; display: inline-block; border-radius: 50%; } </style> </style> </head> <body> <h2>my phonebook</h2> <input type="text" id="myinput" onkeyup="myfunction()" placeholder="search names.." title="type in name"> <ul id="myul"> <li> <div class="chip" style="vertical-align:top;"> <img src="http://farm4.static.flickr.com/3623/3279671785_d1f2e665b6_s.jpg" alt="lobster" width="75" height="75" /> <h4>froodle</h4> moodle access course materials , assignemnts , foster active learning, understanding , collaboration. </div> </li> <li> <div class="chip" style="vertical-align:top;"> <img src="http://farm4.static.flickr.com/3623/3279671785_d1f2e665b6_s.jpg" alt="lobster" width="75" height="75" /> <h4>froodle</h4> moodle access course materials , assignemnts , foster active learning, understanding , collaboration. </div> </li> <li> <div class="chip" style="vertical-align:top;"> <img src="http://farm4.static.flickr.com/3623/3279671785_d1f2e665b6_s.jpg" alt="lobster" width="75" height="75" /> <h4>froodle</h4> moodle access course materials , assignemnts , foster active learning, understanding , collaboration. </div> </li> <li> <div class="chip" style="vertical-align:top;"> <img src="http://farm4.static.flickr.com/3623/3279671785_d1f2e665b6_s.jpg" alt="lobster" width="75" height="75" /> <h4>froodle</h4> moodle access course materials , assignemnts , foster active learning, understanding , collaboration. </div> </li> <li> <div class="chip" style="vertical-align:top;"> <img src="http://farm4.static.flickr.com/3623/3279671785_d1f2e665b6_s.jpg" alt="lobster" width="75" height="75" /> <h4>froodle</h4> moodle access course materials , assignemnts , foster active learning, understanding , collaboration. </div> </li> <li> <div class="chip" style="vertical-align:top;"> <img src="http://farm4.static.flickr.com/3623/3279671785_d1f2e665b6_s.jpg" alt="lobster" width="75" height="75" /> <h4>froodle</h4> moodle access course materials , assignemnts , foster active learning, understanding , collaboration. </div> </li> <li> <div class="chip" style="vertical-align:top;"> <img src="http://farm4.static.flickr.com/3623/3279671785_d1f2e665b6_s.jpg" alt="lobster" width="75" height="75" /> <h4>froodle</h4> moodle access course materials , assignemnts , foster active learning, understanding , collaboration. </div> </li> <li> <div class="chip" style="vertical-align:top;"> <img src="http://farm4.static.flickr.com/3623/3279671785_d1f2e665b6_s.jpg" alt="lobster" width="75" height="75" /> <h4>froodle</h4> moodle access course materials , assignemnts , foster active learning, understanding , collaboration. </div> </li> <li> <div class="chip" style="vertical-align:top;"> <img src="http://farm4.static.flickr.com/3623/3279671785_d1f2e665b6_s.jpg" alt="lobster" width="75" height="75" /> <h4>froodle</h4> moodle access course materials , assignemnts , foster active learning, understanding , collaboration. </div> </li> <li> <div class="chip" style="vertical-align:top;"> <img src="http://farm4.static.flickr.com/3623/3279671785_d1f2e665b6_s.jpg" alt="lobster" width="75" height="75" /> <h4>froodle</h4> moodle access course materials , assignemnts , foster active learning, understanding , collaboration. </div> </li> <li> <div class="chip" style="vertical-align:top;"> <img src="http://farm4.static.flickr.com/3623/3279671785_d1f2e665b6_s.jpg" alt="lobster" width="75" height="75" /> <h4>froodle</h4> moodle access course materials , assignemnts , foster active learning, understanding , collaboration. </div> </li> <li> <div class="chip" style="vertical-align:top;"> <img src="http://farm4.static.flickr.com/3623/3279671785_d1f2e665b6_s.jpg" alt="lobster" width="75" height="75" /> <h4>froodle</h4> moodle access course materials , assignemnts , foster active learning, understanding , collaboration. </div> </li> </ul> <script> function myfunction() { var input, filter, ul, li, a, i; input = document.getelementbyid("myinput"); filter = input.value.touppercase(); ul = document.getelementbyid("myul"); li = ul.getelementsbytagname("li"); (i = 0; < li.length; i++) { = li[i].getelementsbytagname("h4")[0]; if (a.innerhtml.touppercase().indexof(filter) > -1) { li[i].style.display = ""; } else { li[i].style.display = "none"; } } } </script> </body>
there no .chip
class associated html element in code, remove .chip
stylesheet, remove here
.chip img { float: left; /* moves chip image particular side */ margin: 0em .5em 2em 0em; /*moves image down ,moves text next image rightwards,moves image up, moves image right*/ height: 50px; width: 50px; display: inline-block; border-radius: 50%; }
then rerun code , works fine. here codepen
Comments
Post a Comment