CSS - 显示动态高度浮动DIV - 缺少背景图像(CSS - displaying a dynamic height floated DIV - missing background image)
我的目标:
这是我想要完成的。 我们有一个显示在页面上的类别列表。 类别数量未知。 描述可以是几乎任何尺寸......但我们想要一个统一的外观。 所以,我们使用dotdotdot插件将椭圆放在段落上。 将鼠标悬停在项目上时,应展开说明并显示全文。
我希望悬停浮动或覆盖它下面的任何东西。 由于我的一些布局项目(请参阅下面的注释),我的sccontainer元素没有设置高度。 它基于内容动态...具有最大高度设置。
当我在悬停事件中将该高度更改为AUTO(导致文本向下流动并显示所有内容)时,我将丢失sccontainer元素上的背景。
一些相关的CSS:
.sccontainer { width: 280px; zoom: 1; float: left; margin: 5px 10px; padding: 0; border: 1px solid #8697a1; -moz-border-radius: 5px; border-radius: 5px; -moz-box-shadow: 0 0 6px #777; -webkit-box-shadow: 0 0 6px #777; box-shadow: 0 0 6px #777; -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=6, Direction=90, Color='#777777')"; filter: progid:DXImageTransform.Microsoft.Shadow(Strength=6, Direction=90, Color='#777777'); position: relative; background: #fff url(http://imagecss.com/images/background.jpg) repeat-x left top; } .sccontainer .parent { position: absolute; width: 270px; } .sccontainer .image { margin: 5px; float: left; } .sccontainer .image img { width: 48px; } .sccontainer .icon { margin: 0; } .sccontainer p { margin: 8px; padding: 0; max-height: 145px; } .sccontainer h1 { line-height: 24px; display: inline-block; vertical-align: middle; width: 200px; height: 48px; padding: 0; margin: 5px 0 0 0; overflow: hidden; } .sccontainer h1 a { padding: 0; font-size: 24px; color: #fff; font-weight: normal; } .sccontainer .content { position: relative; height: 210px; padding: 0 5px; font-size: 15px; line-height: 22px; width: 270px; } .sccontainer a:hover { text-decoration: underline; } .sccontainer.hover { height: 250px; } .sccontainer.hover .content { height: auto; } .sccontainer.hover .content p { min-height: 135px; max-height: none; }
的jsfiddle:
这是我现在拥有的jsFiddle版本。 如果将鼠标悬停在蓝色框中的文本上,则可以看到此操作。 它有点大,所以我使用jsFiddle而不是把所有的位都放在这里代码标签...
这是我想看到的模型。 方法5a略微扩展以显示完整内容.... yets与红线重叠。 没有其他项目移动或受到影响。
注意:抱歉的东西大小。 我尽可能地减少了它。 此外,我正在修改现有的Intranet网站......它是第三方,所以我对源代码的控制有限 - 因此表的用法。 :(
我尝试/研究的内容:
我认为问题源于我的sccontainer项目是浮动的,并且没有指定高度。 这就是图像消失的原因。
我有一个保留背景的版本......但是sccontainer框没有像我们需要的那样重新调整......文本刚刚溢出来......相当难看。
我不知道足够的CSS来使这一切正常。 如果需要,我并不反对使用jQuery做更多事情。
我确实使用了一个处理大部分悬停的版本:使用:hover stuff ...但它的效果不如jQuery方法。
My Goal:
Here is what I'm trying to accomplish. We have an list of categories that appear on a page. The number of categories is unknown. The description can be pretty much any size... yet we want a uniform look. So, we are using the dotdotdot plugin to put ellipses on the paragraphs. When you hover over the item, it should expand the description and show the full text.
I want that hover to float or overlay whatever is below it. Due to some of my layout items (see my NOTE below) my sccontainer element doesn't have a set height. It's dynamic based on the content... with a max-height set.
When I change that height to AUTO in the hover event (which causes the text to flow down and displays all the content), I lose the background on the sccontainer element.
Some pertinent CSS:
.sccontainer { width: 280px; zoom: 1; float: left; margin: 5px 10px; padding: 0; border: 1px solid #8697a1; -moz-border-radius: 5px; border-radius: 5px; -moz-box-shadow: 0 0 6px #777; -webkit-box-shadow: 0 0 6px #777; box-shadow: 0 0 6px #777; -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=6, Direction=90, Color='#777777')"; filter: progid:DXImageTransform.Microsoft.Shadow(Strength=6, Direction=90, Color='#777777'); position: relative; background: #fff url(http://imagecss.com/images/background.jpg) repeat-x left top; } .sccontainer .parent { position: absolute; width: 270px; } .sccontainer .image { margin: 5px; float: left; } .sccontainer .image img { width: 48px; } .sccontainer .icon { margin: 0; } .sccontainer p { margin: 8px; padding: 0; max-height: 145px; } .sccontainer h1 { line-height: 24px; display: inline-block; vertical-align: middle; width: 200px; height: 48px; padding: 0; margin: 5px 0 0 0; overflow: hidden; } .sccontainer h1 a { padding: 0; font-size: 24px; color: #fff; font-weight: normal; } .sccontainer .content { position: relative; height: 210px; padding: 0 5px; font-size: 15px; line-height: 22px; width: 270px; } .sccontainer a:hover { text-decoration: underline; } .sccontainer.hover { height: 250px; } .sccontainer.hover .content { height: auto; } .sccontainer.hover .content p { min-height: 135px; max-height: none; }
jsFiddle:
Here is a jsFiddle version of what I have right now. You can see this in action, if you hover over the text in the blue box. It's a bit large, so I used jsFiddle instead of putting all the bits here code tags...
And here is a mockup of what I'd like to see. Method 5a expands slightly to show the full content.... yets overlaps the red line. None of the other items move around or are affected.
NOTE: Sorry for the size of things. I've trimmed it down about as much as I can. Also, I am modifying an existing intranet website... it's 3rd party, so I have limited control of the source code - hence the table usage. :(
What I've Tried/Researched:
I believe the issue stems from the fact that my sccontainer item is floating, and doesn't have a height specified. That's why the image disappears.
I had a version that kept the background... but the sccontainer box didn't resize like we need... the text just overflowed it... rather ugly.
I don't know enough CSS to make this all work right. I'm not adverse to using jQuery to do more if needed.
I did work on a version that handled most of the hover using the :hover stuff... but it didn't work quite as well as the jQuery approach.
原文:https://stackoverflow.com/questions/21465064
最满意答案
有一个
RepositoryItemPopupBase.CloseUpKey
属性,您可以使用它来指定用于打开和关闭弹出窗口的组合键。
这里是一个例子:repositotyItemComboBox1.CloseUpKey = new KeyShortcut(Keys.Space);
或者如果您使用就地形式的自定义布局:
comboBoxEdit1.Properties.CloseUpKey = new KeyShortcut(Keys.Space);
There is a
RepositoryItemPopupBase.CloseUpKey
property which you can use to specify the key combination for open and close the popup.
Here is example:repositotyItemComboBox1.CloseUpKey = new KeyShortcut(Keys.Space);
or if you are using custom layout for in-place form:
comboBoxEdit1.Properties.CloseUpKey = new KeyShortcut(Keys.Space);
相关问答
更多-
有一个RepositoryItemPopupBase.CloseUpKey属性,您可以使用它来指定用于打开和关闭弹出窗口的组合键。 这里是一个例子: repositotyItemComboBox1.CloseUpKey = new KeyShortcut(Keys.Space); 或者如果您使用就地形式的自定义布局: comboBoxEdit1.Properties.CloseUpKey = new KeyShortcut(Keys.Space); There is a RepositoryItemPo ...
-
调用gridView.PopulateColumns() 。 Call gridView.PopulateColumns().
-
TextEdit和XtraGrid DevExpress的默认设置(Default Settings for TextEdit and XtraGrid DevExpress)[2021-08-29]
您所要求的(AFAIK)没有选择。 但您可以扩展Gridview并轻松实现它。 public class MyGridView : GridView { public MyGridView() { this.OptionsPrint.UsePrintStyles = true; this.OptionsPrint.EnableAppearanceEvenRow = true; this.OptionsPrint.EnableAppearance ... -
如果您只是想要内联编辑的感觉。 假装。 保持表单字段边框无。 所以它看起来像普通文本。 在悬停突出显示背景的字段。 在焦点显示边框(通过添加类或更改内联样式)。 On Blur再次隐藏边框。 你不需要幽灵隐藏的领域。 而且大多数东西都是css。 使用jquery最小化javascript代码。 :-) If you just want fancy feel of inline editing. Fake it. Keep form fields border none. So it will look li ...
-
听起来像是AdornerLayer给我的工作。 我的实现只会一次显示一个“弹出窗口”,您可以通过再次单击该按钮来隐藏它。 但是你也可以给ContactAdorner添加一个小的关闭按钮,或者坚持你的OK按钮,或者在ContactAdorner后面的AdornerLayer填充一个IsHitTestVisible元素并通过隐藏打开的Adorner对其进行反应(所以点击外面的任何地方关闭弹出窗口) 。 编辑:根据您的要求添加小关闭按钮。 ContactAdorner和ContactDetailsTemplate ...
-
几天前我遇到了同样的问题,但我没有找到任何解决方案。 我从中理解的是,binidng到包含ComboEdit或LookupEdit的网格列的值必须与ComboEdit / LookUpEdit Collection的Vlaue Member值匹配。 如果找到匹配的值,它将在单元格中显示显示成员值,否则单元格值将为空白。 这是我从中获得的工作经验。 I had the same issue few days back but i didn't find any solution for it. What i ...
-
您可以使用GridView.CustomDrawCell事件。 只需将GridCellInfo.CellButtonRect属性设置为Rectangle.Empty ,使用e.DefaultDraw()方法执行默认的单元格绘制,恢复GridCellInfo.CellButtonRect属性的值并绘制后的图像。 这里是一个例子: Private Sub gridView1_CustomDrawCell(sender As Object, e As RowCellCustomDrawEventArgs) Han ...
-
ComboBox编辑器仅在焦点单元格处于编辑状态时存在。 因此, ComboBox在您激活时创建,并在您离开时被销毁。 因此,当按下Button时, GridView中没有ComboBox 。 如果要获取ComboBox值,则需要使用RepositoryItemComboBox事件或编辑GridView事件。 编辑器的链接存储在RepositoryItemComboBox事件的sender参数和GridView.ActiveEditor属性中。 可以使用ComboBox.EditValue属性或使用Grid ...
-
通常,您希望为要在GridControl中显示的每个DataTable都有一个GridView,但是当您在运行时完成所有操作时,您需要为要显示的每个数据源/ DataTable初始化相同的Gridview。 //GridView view; view.PopulateColumns(); view.OptionsView.ColumnAutoWidth = true; view.BestFitMaxRowCount = 10000; // or less ? depends on your data v ...
-
Devexpress - Xtragrid:ArgumentOutOfRangeException(Devexpress - Xtragrid : ArgumentOutOfRangeException)[2022-04-03]
我有时也会在我的应用程序中遇到这种情况。 我主要将我的网格绑定到DataTable ,并且我发现最好的解决方案是,在加载数据时,将gridControl.DataSource设置为null/Nothing并调用Application.DoEvents() 。 填充基础数据源后,将DataSource设置回源。 这样做的目的是实现一种确定性的方式来告知数据何时被加载。 这是一个基本的示例实现。 myGrid.DataSource = Nothing Application.DoEvents FillDataT ...