CSS Width with Custom Tags

谁说我不能喝 提交于 2019-12-13 14:36:09

问题


I am unable to get the width and heigh properties to work for my custom tags please see code below: CSS

 x-slider
 {
    width: 1000px;
    height: 300px;
    border: 1px black solid;    
    background-color: #0000ff;
  }

HTML

<body><x-slider id="CoolPics" page="home"></x-slider></body>

Javascript

  var x = document.registerElement('x-slider', {
    prototype: Object.create(HTMLDivElement.prototype), extends: 'div'
});

I added the Extension of the DIV object to see if that would allow me to specify heigh since some tags do not allow for height. Is it only certain css properties that work with custom tags? Both the border and background color show up, I have tried changing over to both min and max height as well. Please limit response to the question and not the subjective argument of whether you should use custom tags, It made it significantly harder to search for answer for this with every post about custom tags overloaded with those kinda of responses.


回答1:


Add display: block or display: inline-block to x-slider.



来源:https://stackoverflow.com/questions/24854775/css-width-with-custom-tags

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!