如何让边框变短并使搜索表单排成一行?

发布于 2024-12-08 02:12:07 字数 4705 浏览 0 评论 0原文

我正在这个网站上工作: http://www.problemio.com 以及蓝色导航栏上的在它的右侧,我的搜索表单没有水平排列。有没有办法让它做到这一点?

我当前的 html 是这样的:

    <div class="menusystem" id="site_nav">
        <ul class="main_menu_ul"> <!-- The entire nav thing -->

            <li class="main_menu_li"> 
                            <form  name="form" method="post">
                    Search 
                    <input type="text" size="20"> 
                    <input type="submit"  value="Search"></input>   
                   </form>
            </li>           

            <li class="main_menu_li"><a href="http://www.problemio.com/">Support</a>
            </li>


            <li class="main_menu_li_left"><a href="http://www.problemio.com/">Problems</a> 
                <ul class="child_menu_ul">
                    <li class="first"><a href="http://www.problemio.com/">Categories</a></li>

                    <li class="last"><a href="http://www.problemio.com/">Hello 5</a></li>

                </ul>
            </li>
        </ul>
</div>

这是我的菜单项的 css:

.menusystem 
{
    position: absolute;
    font-size: 1em;
    color: white;
}

.menusystem ul, .menusystem li 
{
    margin: 0;
    padding: 0;
}
.menusystem li 
{
    list-style: none outside none;
}

.menusystem ul 
{
    list-style: none;
/*
    -moz-border-radius: 14px;
    -webkit-border-radius: 14px;
*/

}

.menusystem ul li 
{
    position: relative;
/*
    -moz-box-shadow: 2px 2px 4px rgba(0,0,0,0.4);
    -webkit-box-shadow: 2px 2px 4px rgba(0,0,0,0.4);
    -moz-border-radius: 14px;
    -webkit-border-radius: 14px;
*/


}

.menusystem ul li ul 
{
    display: none;
    position: absolute;
    top: 1.6em;
    right: 0;
    width: 10em;    

}

.menusystem li a {
    display: block;
    padding: 5px 10px;
     /* dark blue */
/*  border: 1px solid #2e6ea4; */
    text-decoration: none;
}

.menusystem ul li.main_menu_li 
{
    float:right;
    width: 10em;
    margin-right:0.2em;
    text-align: center;
    border-left: solid 1px white;   
    border-left: solid 1px white;   
}

.menusystem ul li.main_menu_li_left
{
    float:right;
    width: 10em;
    margin-right:0.2em;
    text-align: center;
}

/* IE-Win (Holly hack) reads the list item line breaks, so lets hide those \*/
* html ul li { float: left; }
* html ul li a { height: 1%; }


.menusystem li:hover ul, .menusystem li.mouseHover ul { 
    display: block;
}

.menusystem li ul.child_menu_ul li a
{
    /*
    color: #fff;
    */
    color: #fff;
    /* light blue */
/*  background: #7ba9c9;  */

        font-size: 80%;
    text-shadow: none;
    -moz-border-radius: 0px;
    -webkit-border-radius: 0px;
    border-bottom: 1px solid #2e6ea4;
    border-top: 0px;
    background: none repeat scroll 0 0 #2E6EA4;
}
.menusystem li ul.child_menu_ul li.first a
{
    -moz-border-radius-topleft: 14px;
    -moz-border-radius-topright: 14px;
    -webkit-border-top-left-radius: 14px;
    -webkit-border-top-right-radius: 14px;
    -moz-border-radius-bottomleft: 0;
    -moz-border-radius-bottomright: 0;
    -webkit-border-bottom-left-radius: 0;
    -webkit-border-bottom-right-radius: 0;
    border-top: 1px solid #2e6ea4;
}

.menusystem li ul.child_menu_ul li.last a
{
    -moz-border-radius-topleft: 0px;
    -moz-border-radius-topright: 0px;
    -webkit-border-top-left-radius: 0px;
    -webkit-border-top-right-radius: 0px;
        -moz-border-radius-bottomleft: 14px;
    -moz-border-radius-bottomright: 14px;
    -webkit-border-bottom-left-radius: 14px;
    -webkit-border-bottom-right-radius: 14px;
}

.menusystem li ul.child_menu_ul li.only a 
{
    -moz-border-radius: 14px;
    -webkit-border-radius: 14px;

}

.menusystem li ul.child_menu_ul li a:hover {
    color: #ff0;
    background: #2e6ea4; 
}

/*.menusystem li.main_menu_li a */
.menusystem ul.child_menu_ul a
{
    color: #fff;
/*
    background: -moz-linear-gradient(100% 100% 90deg, #668eb8, #2e6ea4 );
    background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#668eb8), to(#2e6ea4));
*/

    text-shadow: 1px 1px 1px rgba(0,0,0,0.9);
    /*
    -moz-text-shadow: 1px 1px 1px rgba(0,0,0,0.9);
    -webkit-text-shadow: 1px 1px 1px rgba(0,0,0,0.9);
    -moz-border-radius: 14px;
    -webkit-border-radius: 14px;
*/
}

.menusystem li.main_menu_li a:hover 
{
/*      background-color: #2e6ea4; */
    color: #ff0;
}

ul li.spaced
{   
    padding-bottom: 10px; 
    font-weight: normal;    
}

如何水平排列搜索区域?另外,有没有办法让导航项之间的白色边框变短?

I am working on this site: http://www.problemio.com and on the blue navigation bar, on the right side of it, my search form does not line up horizontally. Is there a way to make it do that?

My current html is like this:

    <div class="menusystem" id="site_nav">
        <ul class="main_menu_ul"> <!-- The entire nav thing -->

            <li class="main_menu_li"> 
                            <form  name="form" method="post">
                    Search 
                    <input type="text" size="20"> 
                    <input type="submit"  value="Search"></input>   
                   </form>
            </li>           

            <li class="main_menu_li"><a href="http://www.problemio.com/">Support</a>
            </li>


            <li class="main_menu_li_left"><a href="http://www.problemio.com/">Problems</a> 
                <ul class="child_menu_ul">
                    <li class="first"><a href="http://www.problemio.com/">Categories</a></li>

                    <li class="last"><a href="http://www.problemio.com/">Hello 5</a></li>

                </ul>
            </li>
        </ul>
</div>

and here is my css for the menu items:

.menusystem 
{
    position: absolute;
    font-size: 1em;
    color: white;
}

.menusystem ul, .menusystem li 
{
    margin: 0;
    padding: 0;
}
.menusystem li 
{
    list-style: none outside none;
}

.menusystem ul 
{
    list-style: none;
/*
    -moz-border-radius: 14px;
    -webkit-border-radius: 14px;
*/

}

.menusystem ul li 
{
    position: relative;
/*
    -moz-box-shadow: 2px 2px 4px rgba(0,0,0,0.4);
    -webkit-box-shadow: 2px 2px 4px rgba(0,0,0,0.4);
    -moz-border-radius: 14px;
    -webkit-border-radius: 14px;
*/


}

.menusystem ul li ul 
{
    display: none;
    position: absolute;
    top: 1.6em;
    right: 0;
    width: 10em;    

}

.menusystem li a {
    display: block;
    padding: 5px 10px;
     /* dark blue */
/*  border: 1px solid #2e6ea4; */
    text-decoration: none;
}

.menusystem ul li.main_menu_li 
{
    float:right;
    width: 10em;
    margin-right:0.2em;
    text-align: center;
    border-left: solid 1px white;   
    border-left: solid 1px white;   
}

.menusystem ul li.main_menu_li_left
{
    float:right;
    width: 10em;
    margin-right:0.2em;
    text-align: center;
}

/* IE-Win (Holly hack) reads the list item line breaks, so lets hide those \*/
* html ul li { float: left; }
* html ul li a { height: 1%; }


.menusystem li:hover ul, .menusystem li.mouseHover ul { 
    display: block;
}

.menusystem li ul.child_menu_ul li a
{
    /*
    color: #fff;
    */
    color: #fff;
    /* light blue */
/*  background: #7ba9c9;  */

        font-size: 80%;
    text-shadow: none;
    -moz-border-radius: 0px;
    -webkit-border-radius: 0px;
    border-bottom: 1px solid #2e6ea4;
    border-top: 0px;
    background: none repeat scroll 0 0 #2E6EA4;
}
.menusystem li ul.child_menu_ul li.first a
{
    -moz-border-radius-topleft: 14px;
    -moz-border-radius-topright: 14px;
    -webkit-border-top-left-radius: 14px;
    -webkit-border-top-right-radius: 14px;
    -moz-border-radius-bottomleft: 0;
    -moz-border-radius-bottomright: 0;
    -webkit-border-bottom-left-radius: 0;
    -webkit-border-bottom-right-radius: 0;
    border-top: 1px solid #2e6ea4;
}

.menusystem li ul.child_menu_ul li.last a
{
    -moz-border-radius-topleft: 0px;
    -moz-border-radius-topright: 0px;
    -webkit-border-top-left-radius: 0px;
    -webkit-border-top-right-radius: 0px;
        -moz-border-radius-bottomleft: 14px;
    -moz-border-radius-bottomright: 14px;
    -webkit-border-bottom-left-radius: 14px;
    -webkit-border-bottom-right-radius: 14px;
}

.menusystem li ul.child_menu_ul li.only a 
{
    -moz-border-radius: 14px;
    -webkit-border-radius: 14px;

}

.menusystem li ul.child_menu_ul li a:hover {
    color: #ff0;
    background: #2e6ea4; 
}

/*.menusystem li.main_menu_li a */
.menusystem ul.child_menu_ul a
{
    color: #fff;
/*
    background: -moz-linear-gradient(100% 100% 90deg, #668eb8, #2e6ea4 );
    background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#668eb8), to(#2e6ea4));
*/

    text-shadow: 1px 1px 1px rgba(0,0,0,0.9);
    /*
    -moz-text-shadow: 1px 1px 1px rgba(0,0,0,0.9);
    -webkit-text-shadow: 1px 1px 1px rgba(0,0,0,0.9);
    -moz-border-radius: 14px;
    -webkit-border-radius: 14px;
*/
}

.menusystem li.main_menu_li a:hover 
{
/*      background-color: #2e6ea4; */
    color: #ff0;
}

ul li.spaced
{   
    padding-bottom: 10px; 
    font-weight: normal;    
}

How can I line up the search area horizontally? And also, is there a way to make the white borders between the navigation items shorter?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

木森分化 2024-12-15 02:12:07

要在 IE7 中排列表单,请使用下面的 css。对于其他浏览器,只需调整顶部值即可。

ul.main_menu_ul form{
    position:relative;
    top:-4px;
}

如果您希望白色边框比列表项的高度短,请使用 1px 线条 gif 并将其设置为每个 li 的背景。

例如。

ul.main_menu_ul li{
    background:url(../images/line.gif) no-repeat top right;
}
ul.main_menu_ul li.last{
    background:none;
} 

To line up the form in IE7 use this css below. For other browsers just adjust the top value.

ul.main_menu_ul form{
    position:relative;
    top:-4px;
}

If you want the white borders to be shorter than the height of the list items, use a 1px line gif and set it as a background of each li.

eg.

ul.main_menu_ul li{
    background:url(../images/line.gif) no-repeat top right;
}
ul.main_menu_ul li.last{
    background:none;
} 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文