CSS – Single list with dynamic column wrapping [duplicate] - list

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
CSS: Ways to break list into columns on page?
I was looking for this solution and couldn't find it so I thought I would post what I ended up making.
I was trying to build a single list where after the 5th item the list would wrap and move into another column. This is so it can be super dynamic with how many items the user needs.
Here is the solution I came up with.
li{
position: relative;
line-height: -6px;
}
ol li:nth-child(6) {
margin-top: -90px;
}
ol li:nth-child(-n+5){
margin-left: 0em;
}
ol li:nth-child(n+6){
margin-left: 10em;
}
<ol>
<li>Aloe</li>
<li>Bergamot</li>
<li>Calendula</li>
<li>Damiana</li>
<li>Elderflower</li>
<li>Feverfew</li>
<li>Ginger</li>
<li>Hops</li>
<li>Iris</li>
<li>Juniper</li>
</ol>
Here's the Fiddle: http://jsfiddle.net/im_benton/tHjeJ/
What do you think of my solution??
What is a solution that will work in IE?

Try using the following as #tuff suggested.
ol {
-moz-column-count: 2;
-moz-column-gap: 20px;
-webkit-column-count: 2;
-webkit-column-gap: 20px;
column-count: 2;
column-gap: 20px;
}
http://jsfiddle.net/tHjeJ/6/

Its not that hard if you just want two columns
You could try something like this on your list:
ol{ width:300px;}
li{
width:50%;
float:left;
}​
It would actually wrap equal number of list items in each column if li number divides by column number.
If you want numeration to be like on your picture you could use wrapping divs for each column and then use the start attribute on your list ...it will be something like start="6"

Related

CSS grid two columns different sizes with wrapping

I have a style for a two column grid where I want the first column to be 1fr and the second to be 5fr (or auto). I also want the second column to wrap under the first in responsive/mobile view. My non-wrappig style is this:
.grid-two-column-wide-right {
display: grid;
grid-template-columns: 1fr 5fr;
grid-gap: 1.5rem;
}
I know I have to use repeat and auto-fill but not sure how to keep the static column widths. Any help is appreciated.

Aligning columns using CSS Grid

In CSS Grid, I'm trying to find the best approach to aligning 3 columns, first column to the left, then second and third aligned to the right.
The second and third columns are both dynamic widths, so I need the third column to wrap to its contents width, then push the second columns content to the 'end', so both appear to fill to the right.
I have this working(ish), but I don't think its the best/correct approach. By setting grid-template-columns on the parent container to 200px 1fr, both second and third columns align as I'd like, but I suspect this isn't the correct, or best approach.
Is anyone able to explain how this should be done?
Here is an example of how I have it currently working:
https://jsfiddle.net/Lb0qc7ep/
I am using CSS Grid as at different breakpoints, I need to rearrange the column orders.
Try this:
.container {
display: grid;
grid-template-columns: 1fr auto auto;
grid-gap: 30px;
}
I removed all other CSS when I tried this

Regex to find a particular pattern in Excel

This is the text in cell H1
<a class="stop-propagation" href="javascript:void(0);" data-link="/propertyDetails/poiOnMap.html?lat=19.2412011&longt=73.1290596&projectOrProp=Project&city=Thane&includeJs=y&type=poiMap2017&address=Thane, Maharashtra" id="map_link_27696295" onclick="stopPage=true; showPhotoMap('/propertyDetails/poiOnMap.html?lat=19.2412011&longt=73.1290596&projectOrProp=Project&city=Thane&includeJs=y&type=poiMap2017&address=Thane, Maharashtra');" style="outline: 1px solid blue;"><span class="icoMap"></span>Map</a>
From above cell I'm trying to extract element of 1st occurrence of lat and longt
This is what I have tried
=IF(LEFT(H1,2)="lat=",SUBSTITUTE(H1,"lat=",""),IF(RIGHT(H1,2)="lat=",SUBSTITUTE(H1,"lat=",""),H1))
But it doesn't gives me proper output.
This is what I Expect
lat=19.2412011
longt=73.1290596
Any help would be much appreciated.
Thanks
For the lat=19.2412011,
=TRIM(LEFT(SUBSTITUTE(REPLACE(H1,1,FIND("?",H1),TEXT(,)),"&",REPT(" ",LEN(H1))), LEN(H1)))
For the longt=73.1290596,
=TRIM(MID(SUBSTITUTE(REPLACE(H1,1,FIND("?",H1),TEXT(,)),"&",REPT(" ",LEN(H1))), LEN(H1), LEN(H1)))
For the two together in a single cell with a line feed,
=TRIM(LEFT(SUBSTITUTE(REPLACE(H1,1,FIND("?",H1),TEXT(,)),"&",REPT(" ",LEN(H1))),LEN(H1)))&CHAR(10)&TRIM(MID(SUBSTITUTE(REPLACE(H1,1,FIND("?",H1),TEXT(,)),"&",REPT(" ",LEN(H1))),LEN(H1),LEN(H1)))

Infragistics Webdatagrid: Resize column to largest header/data cell contents

I am searching for a solution that changes the column width based on largest data content or header.
Solutions like
tbody.igg_Item > tr > td
{
white-space: nowrap !important;
}
does not work because the grid sets the column width based on the column header contents not the data, thus the data cell contents is not displayed in its full length.
e.g if content is "my test data content", I can only see "my test dat" because my header is not long enough.
My markup is:
<ig:WebDataGrid ID="WebDataGrid1" runat="server" AutoGenerateColumns="False" Height="350px"
Width="100%">
<ClientEvents MouseDown="GridMouseDown" />
<Behaviors>
<ig:Activation>
</ig:Activation>
<ig:ColumnResizing>
</ig:ColumnResizing>
<ig:Selection CellSelectType="Single">
</ig:Selection>
</Behaviors>
</ig:WebDataGrid>
I am adding the columns in code behind (I have not seen any DataColumn property that controls width)
The grid will automatically size the columns to the data portion of the grid if there is no width set on the column and the grid itself doesn't have a width. Note that you will need to put the grid in a container if you want a horizontal scroll bar and if using paging the pager will scroll with the columns.
I have a more detailed answer to this question here on StackOverflow. I also have this posted in the Infragistics forums here with a sample. I also have a modification of that example that allows wrapping of text in the header if there are multiple words with sample posted here.

toggle show hide first x elements from a list in mootools

i want to show only the first 5 elements of a list and hide the remaining elements, when you click on a "more"-link, the remaning elements of the list must be shown...
it's a bit similar to jQuery toggle show/hide elements after certain number of matching elements but then in mootools (instead of jquery)
A good solution could be a combination of CSS + Mootools
css:
ul{
height: 50px; /* must be the same height as the 5 elements */
overflow: hidden;
}
js:
$('moreLink').addEvent('click', function()
{
$('menu').tween('height', [50, 200]);
}