webdevRefinery Forum: Scrollbar removes right part of images - webdevRefinery Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Rate Topic: -----

User is offline Hermes 

  • Group: Members
  • Posts: 77
  • Joined: 02-May 11

Posted 06 July 2012 - 12:00 AM (#1)

Scrollbar removes right part of images


Hi,

Sample:

<!DOCTYPE html>
<html>
<head>
<title></title>
   <style type="text/css">
	div {display:inline-block; height:200px; overflow-x:hidden; overflow-y:auto;}
        a {display:block;}
	img {border:0;}
   </style>
</head>
<body>
   <div>
	<a href="#"><img src="http://dl.dropbox.com/u/4017788/Labs/thumb1.jpg" alt=""></a>
	<a href="#"><img src="http://dl.dropbox.com/u/4017788/Labs/thumb1.jpg" alt=""></a>
	<a href="#"><img src="http://dl.dropbox.com/u/4017788/Labs/thumb1.jpg" alt=""></a>
	<a href="#"><img src="http://dl.dropbox.com/u/4017788/Labs/thumb1.jpg" alt=""></a>
	<a href="#"><img src="http://dl.dropbox.com/u/4017788/Labs/thumb1.jpg" alt=""></a>
   </div>
</body>
</html>


Except in Internet Explorer and Opera the right part of images are cut. I wonder what's the reason and how they can be displayed the same across different browsers.

Many thanks in advance!
Mike
0


User is offline markbrown4 

  • Group: Members
  • Posts: 385
  • Joined: 17-May 10
  • LocationMelbourne, Austraila
  • Expertise:HTML,CSS,Javascript,Ruby on Rails,Graphics

Posted 14 July 2012 - 09:03 AM (#2)

img { width: 100% } is the fix.

I'm not actually too sure how inline elements should behave within inline-blocks with overflow.
That's a tricky combination that I tend to avoid.
0


User is offline TheEmpty 

  • I say words in sequences.
  • Group: Members
  • Posts: 5154
  • Joined: 02-October 10
  • Expertise:HTML,CSS,PHP,Java,Javascript,Python,Ruby on Rails,SQL

Posted 14 July 2012 - 09:05 AM (#3)

View Postmarkbrown4, on 14 July 2012 - 09:03 AM, said:

img { width: 100% } is the fix.

welcome back. I would recommend max-width: 100%; that way you don't scale-up smaller images.
Reserved.
0


User is offline Hermes 

  • Group: Members
  • Posts: 77
  • Joined: 02-May 11

Posted 14 July 2012 - 09:09 AM (#4)

View PostTheEmpty, on 14 July 2012 - 09:05 AM, said:

welcome back. I would recommend max-width: 100%; that way you don't scale-up smaller images.


Neither makes a difference. Just tried them in Chrome.
0


User is offline markbrown4 

  • Group: Members
  • Posts: 385
  • Joined: 17-May 10
  • LocationMelbourne, Austraila
  • Expertise:HTML,CSS,Javascript,Ruby on Rails,Graphics

Posted 14 July 2012 - 09:23 AM (#5)

View PostHermes, on 14 July 2012 - 09:09 AM, said:

Neither makes a difference. Just tried them in Chrome.

Hmm, I was testing in Firefox.
It doesn't actually effect chrome or safari on my mac as all of the scroll bars are invisible.
The scrollbar position pops into existence only when you scroll and displays over the top of the content - it's not cut off.

It's far too late for me to boot up vmware for windows ;)

Interesting test case though, perhaps it's something to do with interoperability of webkit between mac / windows?

View PostTheEmpty, on 14 July 2012 - 09:05 AM, said:

welcome back. I would recommend max-width: 100%; that way you don't scale-up smaller images.

Thanks, I'm getting back into forums now after a good break.
I'm a Rails / front-end dev full time now and absolutely loving it.
0


User is offline TheEmpty 

  • I say words in sequences.
  • Group: Members
  • Posts: 5154
  • Joined: 02-October 10
  • Expertise:HTML,CSS,PHP,Java,Javascript,Python,Ruby on Rails,SQL

Posted 14 July 2012 - 09:28 AM (#6)

You could also go:
overflow:hidden;
but that means part of the image will be hidden. Your block is not large enough for those images.
Reserved.
0


User is offline Quinn 

  • More pew-pew, less QQ
  • Group: Members
  • Posts: 1307
  • Joined: 08-March 10
  • LocationPalmyra, PA, USA
  • Expertise:HTML,PHP,Javascript

Posted 14 July 2012 - 11:22 AM (#7)

View Postmarkbrown4, on 14 July 2012 - 09:23 AM, said:

Interesting test case though, perhaps it's something to do with interoperability of webkit between mac / windows?

I'm assuming you're on Lion (at least, I heard this was new to Lion)
Posted Image
<Imp> [F3ar 40]  [PWNbear 17]  [magik 15]  [dissident 10]  [mark 7]

View PostKyek, on 07 February 2011 - 07:11 AM, said:

Though anyone who thinks Europe is a country should be smacked in the face. By a train.
0


User is offline DisneyRicky 

  • Group: Members
  • Posts: 57
  • Joined: 17-June 10
  • LocationCalifornia
  • Expertise:HTML,CSS,Graphics

Posted 14 August 2012 - 04:27 AM (#8)

May I suggest just hiding the scrollbar in it's entirety?
Or you could retheme the bar, using some code.

Hiding Bar:
Spoiler


Styling Scrollbar:
Here
0


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Enter your sign in name and password


Sign in options
  Or sign in with these services