JavaScript CSS Scaled Div Centring

I am having an issue centring a <div id='divTwo'> inside another <div id='divOne'>. This is normal an easy thing to do, however in this instance i have transform: scale(); with transform-origin: 50% 50% 0px; applied on 'divTwo'

#divOne {
    top: 0px;
    left: 0px;
    width: 100%;
    height: 100%;
}

#divTwo {
    width: 1024px;
    height: 768px;
    margin: auto;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    border-left: 131px solid #333333;
    border-right: 131px solid #333333;
    border-top: 47.5px solid #333333;
    border-bottom: 47.5px solid #333333;
    border-radius: 55px;
}

if the scale applied to the transform and the window is larger than the outerWidth(), 'divTwo' has no issue centring. However when the 'divTwo' is scaled and the window is smaller or equal to the outerWidth(). The div will no longer centre, instead it will place its centre point to be right side of the browser, resulting if half the of 'divTwo' being off the right hand-side of the browser. Changing transform-origin: 50% 50% 0px; to transform-origin: 0% 50% 0px; works so long as you don't scale vertically, and vice versa.

jsfiddle example : https://jsfiddle.net/yvyz49zp/

Thank you. I feel like am missing something of obvious.

Answer:1

I am using Phonegap and jQuery to develop an app. I have a bit of a bug that has me stumped. I have a back button which looks like this: <div data-role="header"> <a id="...

I am using Phonegap and jQuery to develop an app. I have a bit of a bug that has me stumped. I have a back button which looks like this: <div data-role="header"> <a id="...

I am trying to implement a grid with grouping feature. This is my Model: Model Ext.define('myApp.model.ModelPrueba2', { extend: 'Ext.data.Model', fields: ['id', { name: 'name', type: 'string'...

I am trying to implement a grid with grouping feature. This is my Model: Model Ext.define('myApp.model.ModelPrueba2', { extend: 'Ext.data.Model', fields: ['id', { name: 'name', type: 'string'...

  1. extjs grid grouping multiple columns
  2. extjs grid grouping sort
  3. extjs grid grouping example
  4. extjs grid grouping
  5. extjs grid grouping expand all
  6. extjs grid grouping start collapsed
  7. extjs grid grouping not working
  8. extjs grid grouping collapse all
  9. extjs grid grouping checkbox
  10. extjs grid grouping collapse
  11. extjs grid grouping template
  12. extjs grid grouping tooltip
  13. extjs grid grouping feature
  14. extjs grid grouping column
  15. extjs grid group by multiple fields
  16. extjs grid group header
  17. extjs grid group order
  18. extjs grid group summary
  19. extjs grid group header checkbox
  20. extjs grid grouped column headers

I had an text field where user has to place an url. I need to validate the url whether format is valid.I need to write an reg-exp to find below invalid urls. http://www.google.com//test/index.html //...

I had an text field where user has to place an url. I need to validate the url whether format is valid.I need to write an reg-exp to find below invalid urls. http://www.google.com//test/index.html //...

  1. format validator javascript
  2. validator.js format
  3. validating date format in javascript

I have a site on angular (e.g: app-client.com), where every piece of data comes from another REST API site (e.g: app-api.com). The app-client.com is only a bunch of html, css, and javascript files, ...

I have a site on angular (e.g: app-client.com), where every piece of data comes from another REST API site (e.g: app-api.com). The app-client.com is only a bunch of html, css, and javascript files, ...

  1. twitter oauth without callback url
  2. twitter without oauth
  3. twitter oauth not working
  4. twitter api without oauth