如果我访问手风琴的内容,如何避免自动调整 jQuery Accordion 标题的大小?
脚本:
<script type="text/javascript" >
$(document).ready(function() {
$("#dvAccordion").accordion(
{ autoHeight: false,
collapsible: true
}
);
});
</script>
Run Code Online (Sandbox Code Playgroud)
标记:
<div id="dvAccordion">
<h5><a href="#fragment1"><asp:Label runat="server" ID="lblAccordionRC" Text="Hi" meta:resourcekey="lblAccordionRC" ></asp:Label></a></h5>
<div id="fragment1">
<div style=" height:10px; width:200%; background-color:Blue;"></div>
</div>
<h5><a href="#fragment2"><asp:Label runat="server" ID="lblAccodionUNC" Text="How" meta:resourcekey="lblAccodionUNC"></asp:Label></a></h5>
<div id="fragment2">
How are You ?
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
第一个手风琴包含比第二个更宽的 div。如果我单击第一个手风琴,则会调整手风琴标题的大小。然后,如果我单击第二个手风琴,它会缩小。它使最终用户的页面可视化效果不佳。如何删除此自动调整大小?
我需要根据img高度更改img宽度.我使用了jQuery height属性,但它不起作用.请参阅下面的功能.
$(function imagesSizer(){
var img = document.getElementsByClassName('.offer_img');
if ($('.offer_img').height() < 210) {
$('.offer_img').css('width','360px')
}
});
Run Code Online (Sandbox Code Playgroud) 说我有一个500px的ul.说孩子李是漂浮的.有没有办法写css所以li永远不会去第二行但是根据有多少li来填充ul的500px宽度?
例如.
<ul>
<li>test</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
李将占用整个500px
<ul>
<li>test</li>
<li>test</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
2 li会分开宽度.基本上每个250px
<ul>
<li>test</li>
<li>test</li>
<li>test</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
会分三种方式......
谢谢!
我希望在我的网站上有菜单,但是当我将宽度设置为"自动"并且位置为"固定"时,
width:auto;
菜单的宽度没有变化,只是position:fixed;完成了.
这是一个解释我的问题的图像:

我需要在width: 50%;完成时考虑填充.如果我不这样做,那么第一个div宽度实际上是50% + 2em因为没有考虑填充.
如何计算宽度计算中的填充,或者是否有两个相同大小但填充divs 的解决方法?
小提琴:http://jsfiddle.net/sMuCY/
测试代码:
<div style="padding:1em;float:left;width:50%;background-color:#faa">
This div has 50% width, 1em padding, float left
</div>
<div style="background-color:#0f0;padding:1em">
This is a div with 1em padding
</div>
<hr>
<div style="float:left;width:50%;background-color:#faa">
This div has 50% width and float left
</div>
<div style="background-color:#0f0">
This is a normal div
</div>
Run Code Online (Sandbox Code Playgroud) 嗨,我目前正在一个网站上工作,它设置模仿100%的浏览器宽度.但是,在移动设备上,内容不会占用浏览器的整个宽度,也不会占用较小的分辨率.我已经为所有不同的设备尝试了@ media-screen输入的思维宽度,但它似乎不起作用.
body, html {
width: 100%;
height: 100%;
background:url(images/bg.jpg);
}
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
border: 0;
outline: 0;
font-size: 100%;
vertical-align: …Run Code Online (Sandbox Code Playgroud) 我面临的问题是,尽管明确设置了自己的宽度,但我的表中的 TD 仍在继承表的宽度。
代码如下:
<div class="widget widget-new-products">
<div class="widget-products">
<table cellspacing="0" width="640px" cellpadding="0" border="0" align="center">
<tr>
<td>
<img src="header.gif" alt="New Releases">
</td>
</tr>
<tr style="font-size: 0;">
<td width="30px"><img width="30px" height="95px" src="leftsep.gif" alt="" ></td>
<td width="85px">
<a href="" title="" class="product-image"><img src="product1.jpg" width="85" height="85" alt="image" ></a>
</td>
<td width="100px">
<a style="font-family:sans-serif; font-size:13px; line-height:14px; color:#444; font-weight:bold;" title="" href="">item 1</a>
</td>
<td width="100px" align="right">
<p style="font-family:sans-serif; font-size:22px; line-height:24px; font-weight:bold; color:#e05371; margin:0 0 5px 0;">£30.00</p>
<a href=""><img src="view-product.jpg" height="30px" width="111px" alt="View Product"></a>
</td>
<td width="10px"> …Run Code Online (Sandbox Code Playgroud) 我有一个简单的线性布局,里面有2个按钮.
我设置了layout_width ="fill_parent"
但我希望按钮占据屏幕尺寸的70%,同时我希望它们居中.
我如何实现这一目标.
这就是它现在的样子.

我想要这样的东西.

谢谢.
编辑: XML代码如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 我在Joomla中使用virtuemart添加了一些格式化的div标签.到目前为止,我在这方面取得了成功.我修改了我们用来包含css文件"article.css"的模板,其中包含我的自定义内容.
我所拥有的是一个围绕两个内联div的div包装器,它们都包含文本.第一个内联div具有给定的宽度,因此当您查看文本时,第二个div文本将彼此对齐,就像选项卡一样.这在我自己的测试html文件中运行时非常有效,但是当我在网站上使用它时,width属性不起作用.
使用firefox的"Inspect Element",可以看到div继承了一个宽度并且没有被覆盖,但它仍然显示好像宽度从未出现过!
这是我的CSS:
div.Item_Property
{
border: 2px solid black;
padding-left: 5px;
margin: 2px;
font-size: 16px;
width: 320px;
}
div.Property_Name
{
display: inline;
margin-right: 10px;
color: #C41163;
width: 240px;
}
div.Property_Value
{
display: inline;
}
Run Code Online (Sandbox Code Playgroud)
这是我的HTML片段:
<div class="Item_Property">
<div class="Property_Name">SKU:</div>
<div class="Property_Value">TL-5902/S</div>
</div>
<div class="Item_Property">
<div class="Property_Name">Catalog #:</div>
<div class="Property_Value">15-5902-21530</div>
</div>
<div class="Item_Property">
<div class="Property_Name">Tadiran Series:</div>
<div class="Property_Value">iXtra</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我真的不明白发生了什么.在过去,如果我有一个CSS问题,FireFox的"Inspect Element"会指示我的CSS在那里,但是被覆盖了.在这种情况下,它没有显示这一点,但我猜测网站上的一些设置仍然是我的自定义CSS
有没有人看到是什么原因造成的?谢谢.
我试图将一个元素的宽度与"100%"与下面的代码进行比较.我写了这段代码,但没有用.元素的宽度是100%.请指教
if (document.getElementsByClassName("progress-bar")[0].offsetWidth ==="100%") {
clearInterval(r1);
clearInterval(r2);
clearInterval(r3);
}
Run Code Online (Sandbox Code Playgroud)