{"id":19324,"date":"2020-07-11T01:55:14","date_gmt":"2020-07-11T08:55:14","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=19324"},"modified":"2020-12-29T13:06:29","modified_gmt":"2020-12-29T21:06:29","slug":"html-image-size","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/html-image-size\/","title":{"rendered":"HTML Image Size"},"content":{"rendered":"\n<p><em>The HTML image size refers to the height and width of an image. They are listed as HTML attributes on the <\/em><em>&lt;img&gt;<\/em><em> element. Here\u2019s how to set them.<\/em><br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Syntax<\/h2>\n\n\n\n<p>The syntax for setting the width and height attributes of an <code>&lt;img&gt;<\/code> tag is:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>&lt;img src=&quot;&lt;name of website&gt;&quot; alt=&quot;&lt;alt tag&gt;&quot; height=&quot;&lt;in px&gt;&quot; width=&quot;&lt;in px&gt;&quot; \/&gt;<\/pre><\/div>\n\n\n\n<p>Here\u2019s a code snippet showing how it works:&nbsp;<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n &lt;head&gt;\n   &lt;meta charset=&quot;utf-8&quot;&gt;\n   &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width&quot;&gt;\n   &lt;title&gt;repl.it&lt;\/title&gt;\n   &lt;link href=&quot;style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text\/css&quot; \/&gt;\n &lt;\/head&gt;\n &lt;body&gt;\n   &lt;h1&gt;Image Size in HTML&lt;\/h1&gt;\n   &lt;h2&gt;without attributes&lt;\/h2&gt;\n   &lt;img src=&quot;http:\/\/placekitten.com\/500\/500&quot; \/&gt;\n   &lt;h2&gt;with attributes&lt;\/h2&gt;\n   &lt;img src=&quot;http:\/\/placekitten.com\/500\/500&quot; width=&quot;300&quot; height=&quot;300&quot; \/&gt;\n   &lt;script src=&quot;script.js&quot;&gt;&lt;\/script&gt;\n &lt;\/body&gt;\n&lt;\/html&gt;<\/pre><\/div>\n\n\n\n<p>The height and the width of the <code>&lt;img&gt;<\/code> element is a number in pixels (in between quotes). It is a good idea to indicate both height and width attributes so that the space is allocated for the image before the web page loads. If the size of the image is not indicated prior to page render, the page will adjust it\u2019s layout as the image loads.&nbsp;<br><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Browser Support<\/h3>\n\n\n\n<p>The width and height attributes of an <code>&lt;img&gt;<\/code> element is supported on all web browsers.<\/p>\n\n\n\n<iframe loading=\"lazy\" frameborder=\"0\" width=\"100%\" height=\"400px\" src=\"https:\/\/repl.it\/@careerkarma\/HTML-Image-Size?lite=true\"><\/iframe>\n<br>\n<br>\n","protected":false},"excerpt":{"rendered":"The HTML image size refers to the height and width of an image. They are listed as HTML attributes on the &lt;img&gt; element. Here\u2019s how to set them. Syntax The syntax for setting the width and height attributes of an &lt;img&gt; tag is: &lt;img src=&quot;&lt;name of website&gt;&quot; alt=&quot;&lt;alt tag&gt;&quot; height=&quot;&lt;in px&gt;&quot; width=&quot;&lt;in px&gt;&quot; \/&gt; Here\u2019s&hellip;","protected":false},"author":77,"featured_media":19325,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[17281],"tags":[],"class_list":{"0":"post-19324","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-html"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"HTML","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":null,"is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.0 (Yoast SEO v27.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>HTML Image Size: A Step-By-Step Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"The HTML image size refers to the height and width of an image. They are listed as HTML attributes on the element. Here\u2019s how to set them.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/html-image-size\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HTML Image Size\" \/>\n<meta property=\"og:description\" content=\"The HTML image size refers to the height and width of an image. They are listed as HTML attributes on the element. Here\u2019s how to set them.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/html-image-size\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-11T08:55:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-12-29T21:06:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/jon-tyson-P2aOvMMUJnY-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"765\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Christina Kopecky\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Christina Kopecky\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/careerkarma.com\/blog\/html-image-size\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/html-image-size\/\"},\"author\":{\"name\":\"Christina Kopecky\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e\"},\"headline\":\"HTML Image Size\",\"datePublished\":\"2020-07-11T08:55:14+00:00\",\"dateModified\":\"2020-12-29T21:06:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/html-image-size\/\"},\"wordCount\":141,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/html-image-size\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/jon-tyson-P2aOvMMUJnY-unsplash.jpg\",\"articleSection\":[\"HTML\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/html-image-size\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/html-image-size\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/html-image-size\/\",\"name\":\"HTML Image Size: A Step-By-Step Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/html-image-size\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/html-image-size\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/jon-tyson-P2aOvMMUJnY-unsplash.jpg\",\"datePublished\":\"2020-07-11T08:55:14+00:00\",\"dateModified\":\"2020-12-29T21:06:29+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e\"},\"description\":\"The HTML image size refers to the height and width of an image. They are listed as HTML attributes on the element. Here\u2019s how to set them.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/html-image-size\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/html-image-size\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/html-image-size\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/jon-tyson-P2aOvMMUJnY-unsplash.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/jon-tyson-P2aOvMMUJnY-unsplash.jpg\",\"width\":1020,\"height\":765,\"caption\":\"Photos of different sizes\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/html-image-size\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\/\/careerkarma.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HTML\",\"item\":\"https:\/\/careerkarma.com\/blog\/html\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"HTML Image Size\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\",\"url\":\"https:\/\/careerkarma.com\/blog\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/careerkarma.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e\",\"name\":\"Christina Kopecky\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/image-3-150x150.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/image-3-150x150.jpg\",\"caption\":\"Christina Kopecky\"},\"description\":\"Christina is an experienced technical writer, covering topics as diverse as Java, SQL, Python, and web development. She earned her Master of Music in flute performance from the University of Kansas and a bachelor's degree in music with minors in French and mass communication from Southeast Missouri State. Prior to joining the Career Karma team in June 2020, Christina was a teaching assistant, team lead, and section lead at Lambda School, where she led student groups, performed code and project reviews, and debugged problems for students. Christina's technical content is featured frequently in publications like Codecademy, Repl.it, and Educative.\",\"sameAs\":[\"http:\/\/www.linkedin.com\/in\/cmvnk\"],\"url\":\"https:\/\/careerkarma.com\/blog\/author\/christina-kopecky\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"HTML Image Size: A Step-By-Step Guide | Career Karma","description":"The HTML image size refers to the height and width of an image. They are listed as HTML attributes on the element. Here\u2019s how to set them.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/careerkarma.com\/blog\/html-image-size\/","og_locale":"en_US","og_type":"article","og_title":"HTML Image Size","og_description":"The HTML image size refers to the height and width of an image. They are listed as HTML attributes on the element. Here\u2019s how to set them.","og_url":"https:\/\/careerkarma.com\/blog\/html-image-size\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-07-11T08:55:14+00:00","article_modified_time":"2020-12-29T21:06:29+00:00","og_image":[{"width":1020,"height":765,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/jon-tyson-P2aOvMMUJnY-unsplash.jpg","type":"image\/jpeg"}],"author":"Christina Kopecky","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"Christina Kopecky","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/html-image-size\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/html-image-size\/"},"author":{"name":"Christina Kopecky","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e"},"headline":"HTML Image Size","datePublished":"2020-07-11T08:55:14+00:00","dateModified":"2020-12-29T21:06:29+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/html-image-size\/"},"wordCount":141,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/html-image-size\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/jon-tyson-P2aOvMMUJnY-unsplash.jpg","articleSection":["HTML"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/html-image-size\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/html-image-size\/","url":"https:\/\/careerkarma.com\/blog\/html-image-size\/","name":"HTML Image Size: A Step-By-Step Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/html-image-size\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/html-image-size\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/jon-tyson-P2aOvMMUJnY-unsplash.jpg","datePublished":"2020-07-11T08:55:14+00:00","dateModified":"2020-12-29T21:06:29+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e"},"description":"The HTML image size refers to the height and width of an image. They are listed as HTML attributes on the element. Here\u2019s how to set them.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/html-image-size\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/html-image-size\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/html-image-size\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/jon-tyson-P2aOvMMUJnY-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/jon-tyson-P2aOvMMUJnY-unsplash.jpg","width":1020,"height":765,"caption":"Photos of different sizes"},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/html-image-size\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"HTML","item":"https:\/\/careerkarma.com\/blog\/html\/"},{"@type":"ListItem","position":3,"name":"HTML Image Size"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e","name":"Christina Kopecky","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/image-3-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/image-3-150x150.jpg","caption":"Christina Kopecky"},"description":"Christina is an experienced technical writer, covering topics as diverse as Java, SQL, Python, and web development. She earned her Master of Music in flute performance from the University of Kansas and a bachelor's degree in music with minors in French and mass communication from Southeast Missouri State. Prior to joining the Career Karma team in June 2020, Christina was a teaching assistant, team lead, and section lead at Lambda School, where she led student groups, performed code and project reviews, and debugged problems for students. Christina's technical content is featured frequently in publications like Codecademy, Repl.it, and Educative.","sameAs":["http:\/\/www.linkedin.com\/in\/cmvnk"],"url":"https:\/\/careerkarma.com\/blog\/author\/christina-kopecky\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/19324","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/77"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=19324"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/19324\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/19325"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=19324"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=19324"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=19324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}