Simple Example of JS getting IMG image height and width, js getting img width
Some time ago, when I added the adaptive screen size function to the touchslider. js carousel code written by LJW, I encountered a problem. No matter what method you use,
Before the project background upload pictures need to limit the width of the picture, the beginning of Baidu after the use of JS to judge, but this way there are certain problems, and then changed in the background to judge. Now, both of these
The height of the div or img image is adaptive to the width, and the divimg width is adaptive.
1. You can use js to determine the image width to obtain a specific value, and then use js to set the Image Height (I will not elaborate on it here
Today, I wrote the label effect for the article, and there were several minor issues: the overflow of the content after the img label and the invalid width and height of the label definition. I will record it here. See the implementation code: & amp;
Php generates a thumbnail class and supports custom height and width. It also supports high and wide. The php Tutorial generates a thumbnail class that supports custom height and width. Also supports by height and width? Phpclassresizeimage {image
A problem was encountered when adding adaptive screen-size functionality to the Touchslider.js carousel code written by LJW in the previous period. No matter what method can not get to the high width of the IMG tag, and finally only give the picture
A problem was encountered while adding the adaptive screen Size feature to the Touchslider.js carousel code written by LJW in the previous period. You can't get the high width of the IMG tag in any way, finally, only to the picture to set a high
Why is the height of a label several pixels higher than that of img ?, Label img
Style:
Li {Height: 300px;A {Display: block;Img {Width: 100%;Height: 100%; }}}Effect:
Knowledge supplement: by default, the width and height are the height of
Requirements
For example, on a desktop device, the image uses the following HTML code:
The Code is as follows:
1
On the mobile device side, because the screen is relatively small, if you want to make the image adaptive
Search for the following code in dede/article_add.php:$ Body = AnalyseHtmlBody ($ body, $ description, $ litpic, $ keywords, 'htmltext ');Insert the following code below the code:// Remove the style attribute $ body = preg_replace ("/style =\\\. +? [
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.