带自定义标签的CSS宽度 [英] CSS Width with Custom Tags

查看:59
本文介绍了带自定义标签的CSS宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法获取我的自定义标签的width和heigh属性,请参见下面的代码:CSS

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

Javascript

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

我添加了DIV对象的扩展名,以查看是否可以指定高度,因为某些标签不允许高度.是否只有某些CSS属性可与自定义标签一起使用?边框和背景色都显示出来,我也尝试过同时更改为最小和最大高度.请限制对问题的回答,而不是对是否应使用自定义标签的主观争论进行限制,这使得每篇有关自定义标签的响应都超载的帖子的搜索变得非常困难.

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.

推荐答案

x-slider中添加 display:block display:inline-block 代码>.

这篇关于带自定义标签的CSS宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆