并排显示图像(display images side by side)

我试图并排显示2个箭头链接,但我得到一些CSS错误。

我的html代码如下:

 <div>
    <a href="javascript:void(0);" id="move_down"> <span class="down_arrow">&nbsp;</span> </a>
    <a href="javascript:void(0);" id="move_up">  <span class="up_arrow">&nbsp;</span></a>
    </div>

CSS:

.down_arrow{
display:block;
background: url(../images/down_arrow.png) no-repeat left center;
}

.up_arrow{
display:block;
background: url(../images/up_arrow.png) no-repeat left center;
}

目前,图像一个在另一个下方显示。 我希望然后并排显示。 但是如果我删除display:block; 在css中,图像显示不正确。

我也尝试删除display:block并将float:left放在两个类中,但仍然无效。

如果有人能为我提供解决方案,我将不胜感激。

非常感谢。


I am trying to display 2 arrow links side by side but am getting some css errors.

My html code is below:

 <div>
    <a href="javascript:void(0);" id="move_down"> <span class="down_arrow">&nbsp;</span> </a>
    <a href="javascript:void(0);" id="move_up">  <span class="up_arrow">&nbsp;</span></a>
    </div>

CSS:

.down_arrow{
display:block;
background: url(../images/down_arrow.png) no-repeat left center;
}

.up_arrow{
display:block;
background: url(../images/up_arrow.png) no-repeat left center;
}

Currently, the images are displayed one below another. I want then to be displayed side by side. However if i remove the display:block; in the css, the image is not displayed properly.

I also tried removing the display:block and put float:left for both classes but still not working.

I would be grateful if someone could provide me with a solution.

Many many thanks.


原文:https://stackoverflow.com/questions/6253466
2024-03-07 15:03

满意答案

此方法以递归方式将样式应用于MenuItem及其所有子项及其子项:

<MenuItem Header="Main Menu Item">
    <MenuItem Header="Unaffected Sibling" />

    <MenuItem Header="Foo">
        <MenuItem.Resources>
            <Style TargetType="MenuItem">
                <Setter Property="MenuItem.Header" Value="{Binding InAppName}" />
                <Setter Property="IsCheckable" Value="True" />
                <Setter Property="IsChecked" Value="{Binding IsSomeRandomBoolProperty}" />

                <Setter Property="Background" Value="YellowGreen" />
                <Setter Property="FontWeight" Value="Bold" />
                <Setter Property="Foreground" Value="Red" />
            </Style>
        </MenuItem.Resources>
        <MenuItem Header="Bar" />
        <MenuItem Header="I Am Damo Suzuki">
            <MenuItem Header="Blah blah blah">
                <MenuItem Header="Amon Duul II" />
            </MenuItem>
        </MenuItem>
    </MenuItem>
</MenuItem>

This method applies a style to a MenuItem and all of its children, and their children, recursively:

<MenuItem Header="Main Menu Item">
    <MenuItem Header="Unaffected Sibling" />

    <MenuItem Header="Foo">
        <MenuItem.Resources>
            <Style TargetType="MenuItem">
                <Setter Property="MenuItem.Header" Value="{Binding InAppName}" />
                <Setter Property="IsCheckable" Value="True" />
                <Setter Property="IsChecked" Value="{Binding IsSomeRandomBoolProperty}" />

                <Setter Property="Background" Value="YellowGreen" />
                <Setter Property="FontWeight" Value="Bold" />
                <Setter Property="Foreground" Value="Red" />
            </Style>
        </MenuItem.Resources>
        <MenuItem Header="Bar" />
        <MenuItem Header="I Am Damo Suzuki">
            <MenuItem Header="Blah blah blah">
                <MenuItem Header="Amon Duul II" />
            </MenuItem>
        </MenuItem>
    </MenuItem>
</MenuItem>

相关问答

更多

相互排斥的可检查菜单项?(Mutually exclusive checkable menu items?)

这可能不是您要查找的内容,但是您可以为MenuItem类编写一个扩展,使您可以使用类似于RadioButton类的GroupName属性的内容。 我稍微修改了这个方便的示例,用于类似地扩展ToggleButton控件,并针对您的情况稍微修改了一下,并提出了这个问题: using System; using System.Collections.Generic; using System.Windows; using System.Windows.Controls; using System.Win...

QMenu中的一次QAction可以检查(One QAction checkable at time in QMenu)

一个可能的选择是使用QActionGroup并激活专有属性 import sys from PyQt5.QtWidgets import * class MainWindow(QMainWindow): def __init__(self, *args, **kwargs): QMainWindow.__init__(self, *args, **kwargs) menu = self.menuBar() paymentType = QMe...

如何动态添加MenuItems(带标题)到WPF菜单(How to dynamically add MenuItems (with a header) to a WPF menu)

我承认,我没有深入研究你的例子,或许我应该这样做,但是每当我看到在搜索视觉树的代码隐藏时,我认为可以在视图模型中更明确地处理它? 在我看来,在这种情况下,您可以想出一个非常简单的视图模型 - 例如公开Text , Image , Command和Children属性的对象 - 然后创建一个简单的数据模板,将其呈现为MenuItem 。 然后,任何需要更改菜单内容的操作都可以操作此模型。 编辑: 仔细查看了你的详细信息以及你在博客文章中链接到的两个示例后,我的头靠在桌子上。 这两位开发人员似乎都错误...

使RelativeLayout可检查(Make RelativeLayout checkable)

Holo中的多选列表似乎有两种UI模式(在ActionMode的上下文中):使用复选框或突出显示。 如果您只需要突出显示,您可以使用这个更简单的方法: 让您的列表项目布局使用根类像这样的一个类: public class CheckableRelativeLayout extends RelativeLayout implements Checkable { private static final int[] STATE_CHECKABLE = {R.attr.state_pressed}; b...

Android可选菜单项(Android Checkable Menu Item)

布局看起来正确 但您必须在代码中检查并取消选中菜单项。 从文档 : 当选择可选项目时,系统将调用相应的项目选择的回调方法(例如onOptionsItemSelected() )。 在这里,您必须设置复选框的状态,因为复选框或单选按钮不会自动更改其状态。 您可以使用isChecked()查询项目的当前状态(如用户选择之前的状态isChecked() ,然后使用setChecked()设置检查状态。 Layout looks right. But you must check and uncheck ...

从Collection创建MenuItems(Create MenuItems from Collection)

我在这里找到了答案。 我的XAML首先看起来像这样: <Window.DataContext> <local:MainVM/> </Window.DataContext> <Window.Resources> <CollectionViewSource Source="{Binding Path=MItems}" x:Key="source"/> </Window.Resources> <StackPanel> ...

如何在按下时设置MenuItems工具栏的样式(How to styling MenuItems Toolbar when pressed)

最后,在默认库中查看了一天以上后,我通过以下调整在我的应用程序中工作: 布局文件 <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" style="@style/ToolBarStyle" android:layout_width="match_parent" android:layout_height="wrap_content...

将菜单项绑定到一个集合,使它们可以检查并设置样式(Bind Menuitems to a collection, make them checkable and style the)

此方法以递归方式将样式应用于MenuItem及其所有子项及其子项: <MenuItem Header="Main Menu Item"> <MenuItem Header="Unaffected Sibling" /> <MenuItem Header="Foo"> <MenuItem.Resources> <Style TargetType="MenuItem"> <Setter Property="Men...

$ menuItems中的Yii2 foreach循环(Yii2 foreach loop inside $menuItems)

这可能不是最好的方式,但它适用于我。 function items($teams) { $items = []; foreach ($teams as $team) { array_push($items, ['label' => '' . $team->name .'', 'url' => Url::to(['team/preview', 'id' => $team->id])]); } return...

删除菜单项周围的薄边框(Removing thin border around the menuitems)

... <!-- The Popup is the body of the menu which expands down or across depending on the level of the item --> <Popup ...> <Border x:Name="SubMenuBorder" ... Padding="0">...</Border>...</Popup> ... <!-- The Popup is the body of the menu which ex...

相关文章

更多

Riak, haproxy, and client side applications

转载:http://blog.dloh.org/Riak,-haproxy,-and-client-s ...

Flex 如何输出日志

我们在编写Flex应用程序的时候经常会忽略logging,发现问题需要debug的时候用的最多的就是A ...

图解全文检索SOLR的酷应用[Ajax Solr]

Ajax Solr 是一个使用客户端Javascript库实现的基于Solr的应用库,提供了丰富的应用 ...

mmseg4j相关

http://mmseg4j.googlecode.com/files/mmseg4j-1.8.4.z ...

《C/C++图像处理编程》扫描版[PDF]

中文名: C/C++图像处理编程 作者: 陆宗骐 图书分类: 网络 资源格式: PD ...

Hadoop实现数据库表关联

Hadoop实现数据库表关联主要有两种方式:Map Side Join和Reduce Side Joi ...

solr relevent project

solr 周边的一些开发与扩展 http://code.google.com/p/solr-side/ ...

solr relevent project

solr 周边的一些开发与扩展 http://code.google.com/p/solr-side/ ...

《数字图像处理与机器视觉:Visual C++与Matlab实现》扫描版[PDF]

中文名: 数字图像处理与机器视觉:Visual C++与Matlab实现 作者: 张铮 图 ...

Hadoop作业调优参数整理及原理

1 Map side tuning 参数 1.1 MapTask 运行内部原理 当m ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本