Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #allcomplex>div{
- margin-bottom: 10px;
- display:block;
- }
- .complexmem{
- width: 40vw;
- height:10vw;
- background-color: yellowgreen;
- display: table-cell;
- vertical-align: middle;
- }
- .complexmem>a>img{
- width: 7vw;
- height: 7vw;
- background-color: red;
- }
- .complexmem>img{
- width: 12vw;
- height: 7vw;
- background-color: blue;
- }
- .complexmem>.autotext{
- width: 20vw;
- height: 7vw;
- display:inline;
- color:white;
- background-color: green;
- }
- <div id="allcomplex">
- <div class="complexmem">
- <a href="#">
- <img src="http://science-all.com/images/magnifying-glass-clipart/magnifying-glass-clipart-13.jpg">
- </a>
- <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/26/Microchip_PIC24HJ32GP202.jpg/220px-Microchip_PIC24HJ32GP202.jpg">
- <div class="autotext">
- <span>Computer Center Complex of microchip</span>
- </div>
- </div>
- <div class="complexmem">
- <a href="#">
- <img src="http://science-all.com/images/magnifying-glass-clipart/magnifying-glass-clipart-13.jpg">
- </a>
- <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/f/f8/PIC16CxxxWIN.JPG/220px-PIC16CxxxWIN.JPG">
- <div class="autotext">
- <span>Laptop Center</span>
- </div>
- </div>
- </div>
- function resizeFont(parElem, ratio) {
- var parW = parElem.width();
- ratio = ratio || 7;
- parElem.find('span').each(function () {
- console.log($(this).width());
- console.log(parW);
- console.log(ratio);
- $(this).css('font-size',
- parW / $(this).width() * ratio + 'px');
- })
- }
- resizeFont($(".autotext"));
Add Comment
Please, Sign In to add comment