如何在ASP菜单之间添加空格? [英] How to add spaces between ASP Menu?

查看:150
本文介绍了如何在ASP菜单之间添加空格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计,



我创建了一个菜单控件,将其与web.sitemap配对,我在页面中放置了我想要查看的项目。我可以通过在菜单控件中添加ID来从css更改菜单的外观。但是我无法在哪里找到更改以在每个菜单上添加空间。



这是我的web.sitemap文件

Hey Guys,

I created a menu control, paired it with web.sitemap where I put the items I want to see in the page. I was able to change the look of the menu from css by adding ID in the menu control. But I cant find where should I do the changes to add space on each menu.

Here's my web.sitemap file

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
        
         <siteMapNode url="~/" title="Home"  description="Home">
        <siteMapNode url="Default.aspx" title="Home"  description="Go to HomePage" />
        
        <siteMapNode url="~/Forum/Forum.aspx" title="Forums" description="Go to Forums" >
        <siteMapNode url="~/Forum/AnimeForum.aspx" title="Anime"  description="Anime Discussion" />
        <siteMapNode url="~/Forum/GamesForum.aspx" title="Games"  description="Gaming Discussion" />
        <siteMapNode url="~/Forum/HardwareForum.aspx" title="Hardware"  description="Hardware Discussion" />
        <siteMapNode url="~/Forum/SoftwareForum.aspx" title="Software"  description="Software Discussion" />
        </siteMapNode>
  
        <siteMapNode url="ContentList.aspx" title="Content"  description="Go to Reviews and News">
        </siteMapNode>

        <siteMapNode url="VideoList.aspx" title="Video"  description="Go to Videos" >
        </siteMapNode> 
    </siteMapNode>
</siteMap>







她的主页中包含菜单的代码




And her's the code in the masterpage that holds the menu

<nav id="Nav">

       <asp:Menu ID="Menu1" runat="server" CssClass="MainMenu" DataSourceID="SiteMapDataSource1" Orientation="Horizontal" StaticEnableDefaultPopOutImage="False">
       </asp:Menu>

           <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="False" />
           <asp:SiteMapPath ID="SiteMapPath1" runat="server"></asp:SiteMapPath><br /> 
        
       </nav>





这是css代码:



Here's the css code:

 #Menu1{
Padding-Left :80px;
 }









谢谢,





Thanks,

推荐答案

你可以使用css Padding



You can use css Padding for that.

.yourClass
{
padding-left:50px;
}





现场演示: CSS填充



CSSS填充



更新



Live demo : CSS Padding

CSS Padding

UPDATE

<asp:Menu ID="Menu1" runat="server"  DataSourceID="SiteMapDataSource1"

        RenderingMode="List" StaticDisplayLevels="2" CssClass="MainMenu">
    <LevelMenuItemStyles>
         <asp:MenuItemStyle CssClass="SiteMapLevel1" />
         <asp:MenuItemStyle CssClass="SiteMapLevel2" />
     </LevelMenuItemStyles>

</asp:Menu>






CSS






CSS

.SiteMapLevel1
{
    padding-bottom: 5px;
    padding-top: 5px;

}

.SiteMapLevel2
{

    padding-bottom: 5px;
    padding-top: 5px;
}





点击此处查看更多信息:在菜单控件中使用CSS和样式


在每个菜单后使用...: )
use & nbsp after each menu...:)


嘿伙计,



只是为了不让它挂起而没有答案我只是做我的菜单物品静态现在。我不会使用web.sitemap,只需在菜单所在的母版页中添加项目菜单,给它们id并在css中使用这些id来操作它们。



谢谢,
Hey Guys,

Just for the sake of not letting this hang without an answer I'll just make my menu items static for now. I won't use web.sitemap and just add the item menus in the masterpage where the menu is located, give them id and use those id in css to manipulate them.

Thanks,


这篇关于如何在ASP菜单之间添加空格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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