首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当然很容易但是我不能..。JQUERY UI -小部件-标题

问当然很容易但是我不能..。JQUERY UI -小部件-标题
EN

Stack Overflow用户
提问于 2010-05-10 04:04:17
回答 2查看 792关注 0票数 0

我正在做这个简单的试验,但是谁能告诉我为什么从DIV的边界到H2头的距离这么远?我怎样才能减少它?我不想要空间。

代码语言:javascript
复制
<html> 
    <head> 
        <title>Prova WIDGET</title> 

        <link rel="stylesheet" href="jquery-ui-1.8.custom/css/smoothness/jquery-ui-1.8.custom.css" type="text/css"> 
        <link rel="stylesheet" href="jquery-ui-1.8.custom/development-bundle/ui/jquery-ui-1.8.custom.css" type="text/css"> 

        <script src="jquery-ui-1.8.custom/development-bundle/jquery-1.4.2.js" type="text/javascript"></script> 
        <script src="jquery-ui-1.8.custom/js/jquery-ui-1.8.custom.min.js" type="text/javascript"></script>

  <script type="text/javascript">
    $(themify);

    function themify(){
     $("div").addClass("ui-widget ui-widget-content ui-corner-all");   
     $("input").addClass("ui-button ui-button-text");
     $(":header").addClass("ui-widget-header ui-corner-all");   //ui-widget 
    }
  </script>

  <style>#test{display:none}</style>

  <script type="text/javascript">
   function rendiVisibile(){
    if(document.getElementById("test").style.display = "none"){
     $("#test").css({"width":"200px","float":"right","text-align":"center"});
     $("#test").show("slide",{},1000);
    }
   }
  </script>

    </head> 
    <body> 
        <h2>Tentativo widget con DIV</h2> 
   <form action="">
    <input type="button" value="Submit" id="pulsante" onclick="rendiVisibile()";><br/></br>
     <div id="test">
     <h2>CIAO</h2>
      Un saluto
     </div>
   </form>
 </body>
</html>

这里是CSS;没有填充

代码语言:javascript
复制
.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
.ui-widget .ui-widget { font-size: 1em; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
.ui-widget-content { border: 2px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
.ui-widget-content a { color: #222222; }
.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
.ui-widget-header a { color: #222222; }
EN

回答 2

Stack Overflow用户

发布于 2010-05-10 04:08:57

有两个文件名为"jquery-ui-1.8.custom.css")。

没有视觉效果很难说,但有一种方法可以解决:使用Firefox的"Web Developer“工具栏,选择"Outline”选项菜单,然后选择"Outline Current Element“。将鼠标悬停在问题区域附近的元素上。当错误包含在红色框中时,检查顶部的悬停条以查看CSS选择器的名称。

在本地将选择器设置为您自己的CSS文件或<style>元素中的类似margin:0 0 0 0;的内容,“层叠样式表”的“层叠”部分将发挥作用并解决您的问题。

票数 1
EN

Stack Overflow用户

发布于 2014-10-09 23:18:53

该边距是内置的,作为默认样式表的一部分,与H2上的字体大小相同。

Here's a jsfiddle of your code和here's a jsfiddle of only your HTML, no CSS or JavaScript。注意到还有空白处吗?

要解决这个问题,可以设置一个特定的CSS规则,比如h2 { margin: 0; },或者如果你想重新设置每个元素的样式,也可以使用CSS重置。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2798996

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档