简体   繁体   中英

How to make a vertical CSS menu with arrows on the right of each entry?

I've been trying to get this working for a really long time and am totally stumped. There are tons of articles on the net on how to make a basic CSS list menu, but I'm wanting to make one that looks like this:

Line 1          >>
Line 2          >>
Line 3          >>

Where all of each line is a link (the text, whitespace, and arrows).

I've tried everything I can think of and nothing has worked. I'm sure this is pretty simple to do if you know what you're doing, so can anyone help me out?

Here is what I currently have:

<style type="text/css">
    ul.menu {
        padding: 0;
        margin: 0;
        font-size: 16px;
    }

    ul.menu > li {
        display: block;
        width: 100%;
    }

    ul.menu > li:hover {
        color: red;
    }

    ul.menu > li a {
        display: block;
        width: 100%;
    }

    ul.menu > li > a:hover {
        background-color: #F7F7F7;
    }
</style>

<ul class="menu">
    <li>
        <a href="">Line 1</a>
    </li>
    <li>
        <a href="">Line 2</a>
    </li>
    <li>
        <a href="">Line 3</a>
    </li>
    <li>
    <a href="">Line 4</a>
    </li>
</ul>

Quickest way is with a background image (set on the li or a , depending your design needs):

background:transparent url("http://placehold.it/25x25") right center no-repeat;

http://jsfiddle.net/daCrosby/8aTvn/1/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM