Vertical lists ordered & unordered

I have to make a copy of this jps screen.

My CSS is the following (part affected)

#principal {
	width: 300px;
	height: 600px;
	margin: 0px auto;
}

And this is the affected HTML part with the numbered and unnumberred lists. Types and bullets are different from one part to another.

<div id="principal">
                    <ol>
                        <li><em>Influencers</em> de moda </li>
                          <ul>
.......
                            <li><a href="http://galmeetsglam.com/" target="_blank">Julia Engel</a></li>
                          </ul>
                        <li><em>Influencers</em> de tecnologia</li>
                        <ul>
                            <li><em>Youtubers</em></li>
                            <ul>
                              ....Gary Vaynerchuk</a>
                           .......
                            </ul>
                            <li><em>Entrepreneurs</em></li>
                            <ul>
                                <Melinda Emerson</a>
                            </ul>
                            .....
                        </ul>
                        <li><em>Influencers de fitness</em></li>
                        <ul>
                            <li>Rachel Brathenm </li>


                        </ul>
                        <li><em>Influencers</em> de videojocs</li>
                        <ul>
                            <li>Mark Fishback </li>
                            .....
                          </li>
                        </ul>
                    </ol>

Sorry forr the short code, but as a newbie y can only add une anchor and one image. Somebody can give me a hand to try to solve this issue.

Thanks and regards

Toni

You need to Validate your code first of all. I see <ul> elements as direct children of the <ol> but the only valid direct children can be <li>.
The nested <ul>s must be nested within the <li>s.

The css does not make a lot of sense either. Avoid adding fixed heights to content, allow the content to define its container’s height.
A 300 px width seems a bit tight, but anything above 300 should really be max-width instead of width to allow display on smaller screens.

These are the errors detected during validation

However, due to my lack of HTML capacity, I’m totally unable to solve this.

Thanks

What we are saying is that you can’t do this:

<ol><ul>...</ul></ol> ( the UL is a CHILD of the OL)
you MUST DO THIS:
<ol><li><ul>...</ul></li></ol> (all children of a UL or OL must be LIs)

<h2> Some Title....</h2>

<ol>
	<li>
		<ul>
			<li><a href="">some name-1</a></li>
			<li><a href="">some name-2</a></li>
			<li><a href="">some name-3</a></li>
		</ul>
	</li>
	<li>
		<ul>
			<li>some title-1
				<ul>
					<li><a href="">linked sub item #1</a></li>
					<li><a href="">linked sub item #2</a></li>
					<li><a href="">linked sub item #3</a></li>
					<li><a href="">linked sub item #4</a></li>
				</ul> 
			</li>
			<li>some title-2
				<ul>
					<li><a href="">linked sub item #1</a></li>
					<li><a href="">linked sub item #2</a></li>
					<li><a href="">linked sub item #3</a></li>
					<li><a href="">linked sub item #4</a></li>
				</ul> 
			</li>
			<li>some title-3
				<ul>
					<li><a href="">linked sub item #1</a></li>
					<li><a href="">linked sub item #2</a></li>
					<li><a href="">linked sub item #3</a></li>
					<li><a href="">linked sub item #4</a></li>
				</ul> 
			</li>
		</ul>
	</li>
	<li>
		<ul>
			<li><a href="">some name-1</a></li>
			<li><a href="">some name-2</a></li>
			<li><a href="">some name-3</a></li>
		</ul>
	</li>
	<li>
		<ul>
			<li><a href="">some name-1</a></li>
			<li><a href="">some name-2</a></li>
			<li><a href="">some name-3</a></li>
		</ul>
	</li>
	<li>
		<ul>
			<li><a href="">some name-1</a></li>
			<li><a href="">some name-2</a></li>
			<li><a href="">some name-3</a></li>
		</ul>
	</li>
	<li>
		<ul>
			<li><a href="">some name-1</a></li>
			<li><a href="">some name-2</a></li>
			<li><a href="">some name-3</a></li>
		</ul>
	</li>
</ol>

hope that helps

1 Like

Thans guys. With your support is working awesome.

One more request.

How I can remove the square bullter in the 3rd

  • level and maintain the icon img/right-arrow.png acting as a bullet???

    <li><em>Entrepreneurs</em>
           <ul>
                  <li>
                        <a href="https://succeedasyourownboss.com/" target="_blank"><img src="img/right-arrow.png" alt="fletxa" /> Melinda Emerson</a>
                  </li>
    
  • Thanks for your comment, but still is not working. This is an actual screen shot.

    Try this on the ul

    The list-style-image CSS property specifies an image to be used as the list item marker. It is often more convenient to use the shorthand list-style.

    2 Likes

    Thanks Mittineague, but no way. I’ve changed “ul”, created a img class with {list-style-image: url(“img/right_arrow.png”); and tryied to create li with class img but with no success.

    Thanks to all for the effort.

    I wouldn’t use list image because it is too awkward to style and get right between browsers. Either use a background image or an actual image if the arrow is supposed to be content.

    You could remove the bullet with list-style:none at the appropriate level and then use :before or :after to add the square (or use both as in my example below) assuming the arrow is just decoration.

    I’m assuming you have fixed the html by now so hope I’m not giving too much away as this is your task to complete really :slight_smile:

    I would do something like this:

    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Untitled Document</title>
    <style>
    .principal {
    	max-width:350px;
    	margin:auto;
    	padding:10px;
    	background:#f9f9f9f9;
    	line-height:1.4;
    }
    .principal ol {
    	list-style:decimal;
    	margin:1em 0;
    	padding:0 0 0 1.5em;
    }
    .principal li {
    	margin:0 0 .3em;
    }
    /* second level*/
    .principal ul {
    	list-style:disc;
    	margin:1em 0;
    	padding:0 0 0 1.5em;
    }
    /* third level*/
    .principal ul ul {
    	list-style:none;
    	margin:.5em 0;
    	padding:0;
    }
    .principal ul ul li a {
    	display:block;
    	position:relative;
    	padding:0 0 0 25px;
    }
    .principal ul ul li a:before, .principal ul ul li a:after {
    	content:"";
    	position:absolute;
    	left:0;
    	top:2px;
    	width:16px;
    	height:16px;
    	background:#787f89;
    	z-index:1;
    }
    .principal ul ul li a:after {
    	width:6px;
    	height:6px;
    	left:2px;
    	top:6px;
    	border-left:2px solid #fff;
    	border-bottom:2px solid #fff;
    	transform:rotate(-133deg);
    	z-index:2;
    }
    .principal ul ul a {
    	text-decoration:none;
    }
    .principal ul ul span {
    	text-decoration:underline;
    }
    </style>
    </head>
    
    <body>
    <div class="principal">
      <ol>
        <li><em>Influencers</em> de moda
          <ul>
            <li><a href="http://galmeetsglam.com/">Julia Engel</a></li>
            <li><a href="http://galmeetsglam.com/">Julia Engel</a></li>
            <li><a href="http://galmeetsglam.com/">Julia Engel</a></li>
          </ul>
        </li>
        <li><em>Influencers</em> de tecnologia
          <ul>
            <li><em>Youtubers</em>
              <ul>
                <li><a href="#"> <span>Gary Vaynerchuk</span></a></li>
                <li><a href="#"> <span>Gary Vaynerchuk</span></a></li>
                <li><a href="#"> <span>Gary Vaynerchuk</span></a></li>
              </ul>
            </li>
            <li><em>Entrepreneurs</em>
              <ul>
                <li><a href="#"> <span>Gary Vaynerchuk</span></a></li>
                <li><a href="#"> <span>Gary Vaynerchuk</span></a></li>
                <li><a href="#"> <span>Gary Vaynerchuk</span></a></li>
                <li><a href="#"> <span>Gary Vaynerchuk</span></a></li>
                <li><a href="#"> <span>Gary Vaynerchuk</span></a></li>
              </ul>
            </li>
            <li><em>Social Media</em>
              <ul>
                <li><a href="#"> <span>Gary Vaynerchuk</span></a></li>
                <li><a href="#"> <span>Gary Vaynerchuk</span></a></li>
              </ul>
            </li>
          </ul>
        <li><em>Influencers de fitness</em>
          <ul>
            <li><a href="#">Rachel Brathenm </a></li>
            <li><a href="#">Rachel Brathenm </a></li>
            <li><a href="#">Rachel Brathenm </a></li>
            <li><a href="#">Rachel Brathenm </a></li>
          </ul>
        </li>
        <li><em>Influencers</em> de videojocs
          <ul>
            <li><a href="#">Rachel Brathenm </a></li>
            <li><a href="#">Rachel Brathenm </a></li>
            <li><a href="#">Rachel Brathenm </a></li>
            <li><a href="#">Rachel Brathenm </a></li>
          </ul>
        </li>
      </ol>
    </div>
    </body>
    </html>
    

    It should look like this:

    3 Likes

    Many thanks PaulOB and the other people thatgived a hand to me… Only my last request. Currently I have a png image with the right arrow. It is possible to add the URL on the CSS and not drawing “by hand” the square and the two lines.

    Manu thanks again

    Add padding left to the anchor element on the third level ( much like my example above) and add the arrow image as a normal background image to the anchor (assuming it is decoration only).

    Tha padding left should equal the width of your image element plus a little extra for spacing.

    Have a go and see how you get on:)

    another CSS only option which would give you the same control as you have now, but let you do it via CSS is to use a pseudo element.

    example li li li:before {
     url:('yourImage/arrow.jpg');
    }
    

    hope that helps

    1 Like

    Thanks to all. It seems that finally is working due to your advices.

    This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.