html-lists

Convert comma separated string into list [closed]

我怕爱的太早我们不能终老 提交于 2019-12-23 06:15:31
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I have a string eg: $string = "word1,word2,word3,word4"; I need to echo this into <li> elements using PHP. So $string becomes: <li>word1</li> <li>word2</li> <li>word3</li> <li>word4</li> 回答1: Like this: $string = "word1,word2,word3,word4"; $string = explode(",",$string); foreach ($string as $str) { echo "<li>".

jquery pagination through multiple ul lists

痞子三分冷 提交于 2019-12-23 04:54:10
问题 I can't get this script to work well. Can someone help me? First, I would like to make it that I can use it for multiple <div> and <ul> elements. One other thing, I would like to make it so that if I have more than 5 <li> elements it appends a "next" button and then on page 2, it appends "prev" and "next" buttons. Also, if on the last page "next" button shouldn't be seen. Here is my current code: $('div').each(function(){ $(this).append('<a class="prev">prev</a> | <a class="next">next</a>');

How do I make this expand/collapse FAQ list to work?

心已入冬 提交于 2019-12-23 04:25:25
问题 Here's my list that I want to expand/collapse: My goal is simply to toggle expand/collapse, to have this list act like an accordion. What I don't understand is how to get the <div> from a hidden state to a visible state using the javascript provided below. Any resources or direct help is greatly appreciated. Shipping <li class="plusimageapply"><a name="faq-question">Why do I see prices for some items and not others? How do I get pricing on items that I want to buy?</a></li> <div style=

Space between menu and drop down menu

落花浮王杯 提交于 2019-12-22 18:13:25
问题 I'd like for the drop down menu to show below the border line in the main menu area instead of showing up right underneath the 'menu' title/button. I can change the positioning so that it is lower but then there is dead space in between that makes it impossible to mouse over the drop down menu. I don't want to add padding above the drop down because that just created more purple space, where I want that space to be empty. Below is the code but feel free to view here: link html: <div class=

Sorting li elements by class with jQuery

时光怂恿深爱的人放手 提交于 2019-12-22 08:30:15
问题 I'd like to reorder li elements through an array with jQuery My list code looks like this: <html> <head> <script src="list.js" type="text/javascript" charset="utf-8"></script> <script src="jquery.js" type="text/javascript" charset="utf-8"></script> </head> <body> <div class="list"> <ul class="xyz"> <li class="element1">content for 1</li> <li class="element2">content for 2</li> <li class="element3">content for 3</li> </ul> </div> </body> </html> I now want to reorder the DOM elements through

How to keep <li> elements on single line in fixed width <ul>?

被刻印的时光 ゝ 提交于 2019-12-22 05:55:08
问题 I've a header div and a menu ul below it. I'd like to accomplish 2 things: 1) the ul should have the same width as the div (outer vertical borders exactly same x position 2) I'd like to keep the spacing between li elements roughly equal With some trial and error on the li 's margins and padding I roughly achieved the first point in Google Chrome (please see this jsfiddle) but in Firefox the li 's don't fit in the ul so they don't stay on a single line. Also, the last li tends to 'spill over'

How to keep <li> elements on single line in fixed width <ul>?

扶醉桌前 提交于 2019-12-22 05:55:07
问题 I've a header div and a menu ul below it. I'd like to accomplish 2 things: 1) the ul should have the same width as the div (outer vertical borders exactly same x position 2) I'd like to keep the spacing between li elements roughly equal With some trial and error on the li 's margins and padding I roughly achieved the first point in Google Chrome (please see this jsfiddle) but in Firefox the li 's don't fit in the ul so they don't stay on a single line. Also, the last li tends to 'spill over'

CSS to select all li in ul

我与影子孤独终老i 提交于 2019-12-22 05:08:08
问题 I want to write a CSS selector that selects all li elements within a ul element in a document but I don't know how that would be done. Can you help? 回答1: ul > li { /* css styles go here */ } or ul li { /* css styles go here */ } the first selects only direct children the second selects all li nested within an ul . 回答2: This should work: ul li { /*css here */} 回答3: You can use ul li { /* your code here */ } 来源: https://stackoverflow.com/questions/12464500/css-to-select-all-li-in-ul

CSS to select all li in ul

为君一笑 提交于 2019-12-22 05:07:36
问题 I want to write a CSS selector that selects all li elements within a ul element in a document but I don't know how that would be done. Can you help? 回答1: ul > li { /* css styles go here */ } or ul li { /* css styles go here */ } the first selects only direct children the second selects all li nested within an ul . 回答2: This should work: ul li { /*css here */} 回答3: You can use ul li { /* your code here */ } 来源: https://stackoverflow.com/questions/12464500/css-to-select-all-li-in-ul

Turning an unordered list into a table of contents

浪尽此生 提交于 2019-12-22 04:54:20
问题 Reference this fiddle: http://jsfiddle.net/exGnZ/ Hi, I'm trying to reproduce a table of contents with an unordered list and leader dots. Unfortunately, when there's a long line of content, the formatting breaks down. Does anyone know how to get Chapter 2 in the image below to appear on the same line as the dots? Here's the code I've got at the moment: http://jsfiddle.net/exGnZ/ I'm also pasting it here: <div> <ul id="toc"> <li><span>Introduction</span> <a href="#">Chapter 1</a></li> <li>