Results 1 to 6 of 6

Thread: Centered Issues

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Aug 2011
    Cincinnati, OH
    Vote Rating

    Default Centered Issues

    I'm trying to display a large image so that it scales down to the height and width of the Container it resides in. This Container is being instantiated in my Viewport, which is a TabPanel.

    Ext.define('App.view.ImagePage', {
        extend: 'Ext.Container',
        alias: 'widget.imagepage',
        config: {
            style: 'background:url("resources/bg-image.jpg")'
        initialize: function() {
            var imagePanel = Ext.create('Ext.Panel', {
                centered: true,
                html: '<img src="resources/imagepage/image.jpg" />'
            console.log('View/ImagePage: Initialized')
    I've attached pictures if you'd like to see. My two problems are:

    1.) Why do I have this space across the bottom of my floating image? It's almost as if there is a padding/margin issue. You can also see the problem if you use 'Ext.Img' instead of 'Ext.Panel':
    var imagePanel = Ext.create('Ext.Img', {
        centered: true,
        mode: 'image',
        style: 'border:5px solid black;',
        src: 'resources/imagepage/image.jpg',
    2.) Also, more importantly, why does using 'centered' align, center and scale the panel perfectly horizontally but NOT vertically? It doesn't seem to scale down when the image's vertical size exceeds the Container's. It does recognize the top edge, but not the bottom. Scrolling is not turned on anywhere. Using 'Ext.Img' instead of 'Ext.Panel' behaves identically.

    Please help. I have tried many different styling solutions, but can't seem to get it perfect. If anyone has a recommendation I'm all ears.
    Last edited by npenny; 13 Jun 2012 at 3:59 PM. Reason: Additional info in Problem 2.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts