Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

MyCode image w/h

#1
Hey Darth,

As some of you may or may not know, you can embed an image like so:
Code:
[img]url[/img]

However you should be able to specify a width and height too:
Code:
[img=50x50]url[/url]

This adds a width="50" and height="50" to the image tag. However in your global.css file you have the following class which is overwriting any custom image dimensions:
Code:
.scaleimages img {
   /* max-width: 100%; */
   height: auto;
   width: auto;
}

Now, the reason max-width is commented out, is because you also have the following, which overwrites the scaleimages:
Code:
#posts_container img {
   max-width: 100%;
}

Why do we use max-width and why is it required? The max-width: 100% is set to make sure that any image that is inside the post container is scaled to fit either the full size image, or the full size of the post container - which ever comes first. Without this, any image that has dimensions above that of the post container would completely break the page.

What's causing the custom dimensions to be overwritten? To put it simply, the scaleimages class. As we have already established the max-width attribute is obsolete due to the post_container img class. So the only attributes left are the height and width set at auto, this is requesting that the image uses its own pre-defined image dimensions.

Why does the .scaleimages class include the height: auto; width: auto;? I don't have a clue to be fair, as far as I'm aware it is not used in the default MyBB theme, so this has been added by Darth? As I'm not aware of his reasoning, and can't figure it out myself, so I deem this useless. Tongue

Solution? Remove the .scaleimages class from your CSS completely. Your post_container img class is handling the max-width attribute already, forcing any image regardless of original or custom dimensions to scale down to fit in the page. Any image smaller will hold it's original size or use the custom defined size.

PEAOYCE
[Image: forumonic-bar.png]...............[Image: xige-logo-png-blue-sml.png]
Latest snapshots: Postbit Design - Multi Login Modal (1) - Responsive Pollbar
Reply


Messages In This Thread
MyCode image w/h - by Harry K. - June 26th, 2018 at 5:03 PM
RE: MyCode image w/h - by Darth-Apple - June 26th, 2018 at 6:34 PM
RE: MyCode image w/h - by Harry K. - June 26th, 2018 at 7:14 PM
RE: MyCode image w/h - by SpookyZalost - June 27th, 2018 at 5:03 AM
RE: MyCode image w/h - by Darth-Apple - June 27th, 2018 at 5:34 AM
RE: MyCode image w/h - by Harry K. - June 27th, 2018 at 8:48 AM
RE: MyCode image w/h - by Guardian - June 27th, 2018 at 9:46 PM
RE: MyCode image w/h - by Harry K. - June 27th, 2018 at 10:47 PM
RE: MyCode image w/h - by Guardian - June 28th, 2018 at 2:31 AM
RE: MyCode image w/h - by Darth-Apple - June 28th, 2018 at 2:38 AM



Users browsing this thread: 1 Guest(s)

Dark/Light Theme Selector

Contact Us | Makestation | Return to Top | Lite (Archive) Mode | RSS Syndication 
Proudly powered by MyBB 1.8, © 2002-2024
Forum design by Makestation Team © 2013-2024