HTML split a list in multiple columns - html-lists

I'm trying to divide my list into multiple columns.
Example:
<ul class="loremipsum">
<li>Lorem ipsum 01</li>
<li>Lorem ipsum 02</li>
<li>Lorem ipsum 03</li>
<li>Lorem ipsum 04</li>
<li>Lorem ipsum 05</li>
<li>Lorem ipsum 06</li>
<li>Lorem ipsum 07</li>
<li>Lorem farem 08</li>
<li>Lorem ipsum 09</li>
<li>Lorem ipsum 10</li>
<li>Lorem ipsum 11</li>
<li>Lorem ipsum 12</li>
<li>Lorem ipsum 13</li>
<li>Lorem ipsum 14</li>
<li>Lorem ipsum 15</li>
<li>Lorem ipsum 16</li>
</ul>
Lorem ipsum 01 Lorem ipsum 06 Lorem ipsum 11 Lorem ipsum 16
Lorem ipsum 02 Lorem ipsum 07 Lorem ipsum 12 etc
Lorem ipsum 03 Lorem ipsum 08 Lorem ipsum 13
Lorem ipsum 04 Lorem ipsum 09 Lorem ipsum 14
Lorem ipsum 05 Lorem ipsum 10 Lorem ipsum 15
This is not a problem with jquery as I have found "Easy List Splitter".
However, this does not provide me with what I need.
The problem with the script of "Easy List Splitter" is that I need to put in an amount of columns. This is a problem for me because I'll be adding new items to this list weekly (if not daily) at the top of the list. It would mean I would need to edit the js file everytime.
Now that wouldn't even be a big problem (editting the amount of columns).
However, some of these list items (maybe 1 out of 10) is an image link.
What I would like to accomplish is this (numbers are just examples):
a wrapper div with 300px height
each list item has a min-height of 60px
max. 5 items per column
min. 1 item per column ofcourse
any column (left, right or the center) should be able to have only 1 list item if that 1 list item is 300px height for example (or 2 of 150px etc)
must be a vertical list
new column automatically created on the right of the other columns
A better question is........is this possible?
If new DIV's would show below/on top of eachother instead of next to eachother, the problem was solved already.
Big big thanks in advance!
If any more questions, please ask.

You might find some interest in this W3C recommendation about Multiple-Column layout which you can already use (with some prefixes though) on modern browsers.
Maybe not exactly what you would have wanted, but I think this is the best solution for your problem at the moment...

The nearest solution I found is to make LI float left and assign a width of 33% (for 3 columns) but it will not fill a column before starting another. The CSS Indeed is not complex.
.loremipsum li {
display: inline;
float: left;
width: 25%;
}
http://jsfiddle.net/cSJNm/

Related

Dompdf text not wrapping in table cell

Can someone explain this to me please, i have a Laravel app (probably not important) and am using dompdf when i use the HTML below
<head>
<style type="text/css">
</style>
</head>
<body>
<table style="width:100%;">
<tr>
<td>
<p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p>
</td>
</tr>
</table>
</body>
</html>
out of the box i get this....
Why does the text not wrap around, and why does it go off the screen, am i missing something really obvious?
Thanks
Some style not working on dom-pdf so for now just try with giving black solid border of 1px to
Just add this code in your CSS:
td {
border: 1px solid black;
}
Adding style="white-space:wrap" worked for me. It justifies the text and matches the cell width.
<td style="white-space:wrap">My long text goes here. My long text goes here. My long text goes here. My long text goes here. My long text goes here. My long text goes here. My long text goes here. My long text goes here. My long text goes here.</td>

Display formatted paragraphs on Laravel 5.8

I'm trying to build a blog and I'm stuck at something.
When I add a post, I'm adding spaces and building block textes, like paragraphs, and I want to display them exactly in the same form as they were written.
eg:
"*Lorem ipsum lorem ipsumipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum lorem ipsum* "
is rendered as one line:
"lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum "
How can I do that? Thank you
One approach is to add some simple CSS to the page. Add a class name to the wrapping html tag:
<div class="class-name">
*Lorem ipsum lorem ipsumipsum lorem ipsum lorem ipsum lorem ipsum lorem
ipsum lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum lorem ipsum*
</div>
And add the following CSS:
.class-name {
white-space: pre-wrap;
}
pre-wrap allows:
Sequences of white space are preserved. Lines are broken at newline
characters, at < br>, and as necessary to fill line boxes.
While the default, normal, is the following:
Sequences of white space are collapsed. Newline characters in the
source are handled the same as other white space. Lines are broken as
necessary to fill line boxes.
You can read more about the white-space attribute here.
Alternatively, you can use the <pre> html tag to achieve a similar outcome.
The HTML element represents preformatted text which is to be
presented exactly as written in the HTML file. The text is typically
rendered using a non-proportional ("monospace") font. Whitespace
inside this element is displayed as written.
You can use a WYSIWYG tool like CKFinder or Summernote, and save the html in your db. Then render it {!!$post->text!!}

ZPL: Multiple textboxes under each other

I would like to print a label with multiple text boxes (something like^FB600,3,0,c,0) under each other. The text boxes need to have different fonts and each of them might have variable number of rows.
The issue is how to position these two textblocks under each other so that they don't overlap.
To demonstrate the problem, I use this tool: http://labelary.com/viewer.html
Please try following code:
^XA
^FO0,0
^CF0,50
^FB600,4,0,c,0
^FDLorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer vulputate sem a nibh rutrum consequat. Etiam egestas wisi a erat. Fusce tellus.
^FS
^FO0,300
^CF0,40
^FB600,3,0,c,0
^FDNulla quis diam. Curabitur ligula sapien, pulvinar a vestibulum quis, facilisis vel sapien. In convallis.
^FS
^XZ
The problem is the ^FO0,300 as it is absolute, I need to position the second block according to the first one.

How can I gradually change font across a text frame in InDesign?

I would like to change the Typeface or Font Weight across a text frame gradually either by character, word, line, sentance or so on (basically any grep function).
I am generating (or interpolating) fonts so that I have a font family with the weights 1,2,3,4,5,6,7 which would change in the above fashion.
Unfortunately I do not have the scripting skills at the moment... Basil.JS looks promising though. Any help would be appreciated.
this should do the trick to change the font sizes of a characters, words and lines ...
for a sentence based interpolation you have to parse the content of the text frame according to '.' ... and then iterate in a second step over the individual groups of characters for each sentence. sadly indesign doesn't have a built-in collection for sentences.
hope that helps.
#includepath "~/Documents/;%USERPROFILE%Documents";
#include "basiljs/bundle/basil.js";
function draw() {
var lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam pellentesque ultrices dolor, vitae venenatis erat.";
var tf = b.text(lorem, 0, 0, 300, b.height);
// replace words with characters/words/lines/
for (var i = 0; i < tf.words.length; i++) {
tf.words[i].pointSize = b.map(i, 0,tf.words.length, 5,30);
};
}
b.go();
see also the typography related basil.js examples: https://github.com/basiljs/basil.js/tree/master/examples/typography

iterating over yaml data in middleman template

I have a list of projects in a yaml file which i'd like to dynamically loop thru for a template in a middleman app but am unsure how or if I even can/should do it more dynamically.
I have:
data.projects.each do |f|
proxy "/work/#{f[:name].parameterize}.html", "/work/template.html",
:locals => { name: f[:name], client: f[:client], ... } #would like to dynamically pull in keys as locals.
end
ignore "/work/template.html"
Yaml:
- name: Acme Website
client: Acme Inc
overview: "Cupcake ipsum dolor sit amet wafer gummi bears pudding applicake. Jujubes brownie powder. Sweet roll powder gingerbread gummies. Cupcake ice cream sweet roll pie lollipop. Jelly-o jelly-o apple pie chupa chups jelly jujubes gingerbread. Icing carrot cake powder chupa chups. Pudding sweet roll jelly-o muffin faworki biscuit. Marzipan marshmallow cake tiramisu caramels bear claw carrot cake cotton candy. Toffee danish sweet roll. Cookie topping powder toffee ice cream muffin dragée. Soufflé caramels apple pie chocolate cake cookie cake. Macaroon tiramisu halvah soufflé. Dessert toffee halvah chocolate cake bear claw."
skills:
- design
- development
- branding
- ecommerce
stack:
- middleman
- branding
- design
Maybe you could just use the full projectobject within your templates?
data.projects.each do |p|
proxy "/work/#{p[:name].parameterize}.html", "work/template.html",
:locals => { :p => p }
end
... should give you access to your project within http://0.0.0.0:4567/work/acme-website.html:
<ul>
<li><%= p.name %></li>
<li><%= p.client %></li>
</ul>
Result:
Acme Website
Acme Inc
First you need to parse the YAML back into a Ruby object, then go from there:
require 'yaml'
doc = YAML.load(<<EOT)
---
- name: Acme Website
client: Acme Inc
overview: "Cupcake ipsum dolor sit amet wafer gummi bears pudding applicake. Jujubes brownie powder. Sweet roll powder gingerbread gummies. Cupcake ice cream sweet roll pie lollipop. Jelly-o jelly-o apple pie chupa chups jelly jujubes gingerbread. Icing carrot cake powder chupa chups. Pudding sweet roll jelly-o muffin faworki biscuit. Marzipan marshmallow cake tiramisu caramels bear claw carrot cake cotton candy. Toffee danish sweet roll. Cookie topping powder toffee ice cream muffin dragée. Soufflé caramels apple pie chocolate cake cookie cake. Macaroon tiramisu halvah soufflé. Dessert toffee halvah chocolate cake bear claw."
skills:
- design
- development
- branding
- ecommerce
stack:
- middleman
- branding
- design
EOT
require 'pp'
pp doc
Which outputs:
[{"name"=>"Acme Website",
"client"=>"Acme Inc",
"overview"=>
"Cupcake ipsum dolor sit amet wafer gummi bears pudding applicake. Jujubes brownie powder. Sweet roll powder gingerbread gummies. Cupcake ice cream sweet roll pie lollipop. Jelly-o jelly-o apple pie chupa chups jelly jujubes gingerbread. Icing carrot cake powder chupa chups. Pudding sweet roll jelly-o muffin faworki biscuit. Marzipan marshmallow cake tiramisu caramels bear claw carrot cake cotton candy. Toffee danish sweet roll. Cookie topping powder toffee ice cream muffin dragée. Soufflé caramels apple pie chocolate cake cookie cake. Macaroon tiramisu halvah soufflé. Dessert toffee halvah chocolate cake bear claw.",
"skills"=>["design", "development", "branding", "ecommerce"],
"stack"=>["middleman", "branding", "design"]}]
That's an array of hashes. You can iterate over the returned array, and extract the embedded hashes and process them normally:
doc.each { |h|
puts h['name']
puts h['client']
}

Resources