0

or: I need a opaque transparency!

edit based on comments and answer: I try to find a solution for leading / trailing dots on a non constant background ie. picture. The solutions I found and found at others, draw dots in the back and over draw it with the text. but this does not work or looks bad with picture backgrounds.

Imagine a price list; looking like this

spoon .............. 0,10
knife .............. 0,20
sharp knife ....... 10,20
a complete set 
of spoons .......... 8,40

but also

best price
    spoon .......... 0,09
    knife .......... 0,90

best quality
    spoon .......... 2,60           

The point is descriptions starts left - price ends right and "dots" fill and all is table like.

My ideas are - and I break it down to basics;

description is a div with left aligned text, price a div with right aligned text, and I have jQuery that sizes the div in the middle when rendering, this div has the dots as background (I don't care if they are aligned - ie. all dots above same column)

but - the spoon collection breaks the logic:

spoon .............. 0,10
knife .............. 0,20
sharp knife ....... 10,20
a complete set 
of spoons       .... 8,40

Next idea:

Make background width dots and a span inside the div that override the background - that has the dots - with white.

Here I try to show with a semi opaque background - the dots are here - but hard to see

.background {
 background: url(http://keepitsimple-soft.com/assets/gif/dark_mtall.png);  
}
.item-line {
 background: url(http://keepitsimple-soft.com/assets/gif/8/light_back.png) ;
 background-repeat:   repeat-x;
 background-position: 0 bottom;
}

.desc {
width:100px;

}
.opaque{
 padding-right:15px; 
 background:rgba(255,255,255,0.1);
}
<div class='background'>
<div class='item-line'>
<div class='desc'>
<span class='opaque'>  the spoons are annoying </span>
</div>   
</div>
</div>

this works in all cases, except there is a background for the whole thing, like show in snipped ...

so i would need a "opaque transparency" - any ideas

halfbit
  • 3,773
  • 2
  • 34
  • 47
  • The question could use some clarification, especially a summary of what you want before you go into details. – Domino Dec 09 '15 at 21:29
  • I believe that they're called leader dots. – j08691 Dec 09 '15 at 21:38
  • @JacqueGoupil: gimme - please - some time to refine – halfbit Dec 09 '15 at 21:44
  • A decent answer on the topic: http://stackoverflow.com/questions/5476673/css-justify-text-fill-space-with-dots – deebs Dec 09 '15 at 21:48
  • @deeps: there is a reason for "white-space: no-wrap" in your example - does not work with mine – halfbit Dec 09 '15 at 21:51
  • @halfbit have you tried to implement it the like in the example I brought? – yossico Dec 09 '15 at 21:54
  • I just learned that there is no way to make dotted lines through CSS, which I feel should have been possible long ago. `text-decoration-style` is only a candidate recommendation implemented only by Firefox (and Chrome with experimental features on). Well, sounds like we're reduced to cheap hacks like borders for now. – Domino Dec 10 '15 at 03:48

1 Answers1

0

@import url(http://fonts.googleapis.com/css?family=Muli:300italic);
*, *:after, *:before {
  box-sizing: border-box;
  -moz-box-sizing: border-box;
}
* {margin:0;padding:0;border: 0 none;position: relative;}
html, body {
  background: #7658F9;
  padding-top: 1rem;
  font-family: muli;
  font-weight: 300;
  font-style: italic;
}
.break {
  background: inherit;
  width: 70%;
  max-width: 40rem;
  min-width: 300px;
  margin: 0 auto;
  font-size: 1.2rem;
  line-height: 1.5rem;
  color: #fff;
  padding-right: 4rem;
  margin-bottom: .5rem;
}
p {
  background: inherit;
  width: 70%;
  max-width: 40rem;
  min-width: 300px;
  margin: 0 auto;
  font-size: 1.2rem;
  line-height: 1.5rem;
  color: #fff;
  padding-right: 4rem;
  margin-bottom: .5rem;
}
p:before {
  content: '';
  position: absolute;
  bottom: .4rem;
  width: 100%;
  height: 0;
  line-height: 0;
  border-bottom: 2px dotted #ddd;
}
.descripcion {
  background: inherit;
  display: inline;
  z-index: 1;
  padding-right: .2rem;
}
.precio {
  background: inherit;
  position: absolute;
  min-width: 4rem;
  bottom: 0;
  right: 0;
  padding-left: .2rem;
  text-align: right;
  z-index: 2;
}
.precio:after {
  content: '€';
}
h1 a {
  display: block;
  text-decoration: none;
  color: rgba(0,0,0,.55);
  margin-bottom: 1rem;
  text-align: center;
  transition: .5s;
}
h1 a:hover {
  color:  rgba(0,0,0,.3);
  letter-spacing: 2px;
}
<h1><a href='http://ksesocss.blogspot.com/2013/12/autorellenado-puntos-entre-elementos.html'>Las demos en oferta de KsesoCss</a></h1>

<p>
  <span class='descripcion'>Trócola</span>
  <span class='precio'>56´72</span>
</p>
<p>
  <span class='descripcion'>Junta la trócola</span>
  <span class='precio'>0´33</span>
</p>
<p>
  <span class='descripcion'>Gamusinos en oferta c/u</span>
  <span class='precio'>6´47</span>
</p>
<p>
  <span class='descripcion'>Saco de rafia y linterna a pedales</span>
  <span class='precio'>12´64</span>
</p>
<div class="break">
  <span class='descripcion'>Small break</span>
</div>
<p>
  <span class='descripcion'>Jaula de bambú con led para gamusinos</span>
  <span class='precio'>21´99</span>
</p>
<p>
  <span class='descripcion'>Otro concepto más repartido entre más de una, o de dos, o de tres líneas de texto y así ver cómo se comporta en esta situación</span>
  <span class='precio'>1.694´99</span>
</p>
<p>
  <span class='descripcion'>Chismes y achiperres surtidos</span>
  <span class='precio'>c/u 0´10</span>
</p>
<p>
  <span class='descripcion'>Yugo, barzón, cavijal y mancera</span>
  <span class='precio'>33´74</span>
</p>
<div class="break">
  <span class='descripcion'>Another small break</span>
</div>
<p>
  <span class='descripcion'>Coyunda, sobeo, ramales y cordel</span>
  <span class='precio'>125´87</span>
</p>
<p>
  <span class='descripcion'>Media, cuartilla, celemín y 1 envuelza</span>
  <span class='precio'>48´04</span>
</p>

I found it there: http://codepen.io/Kseso/pen/fxrsL

EDIT: Added small breaks divs - as you needed that in your question

yossico
  • 3,421
  • 5
  • 41
  • 76
  • 1
    Copy-pasting code without explanation isn't really an answer. – Domino Dec 09 '15 at 21:27
  • He wants line of dots - this is example of what he wants - in pure css. I'm sure that he can use this. @JacqueGoupil – yossico Dec 09 '15 at 21:31
  • @yossico: your example - does the same as mine - put dots in background, and over draw them with span. myprob is a picture background http://codepen.io/anon/pen/wMaPgj – halfbit Dec 10 '15 at 10:21
  • @halfbit can you please be more clear about the result you are trying to get? an image will be nice – yossico Dec 10 '15 at 12:49
  • @yossico: http://codepen.io/anon/pen/wMaPgj - I used your example, here I use javascript for half a solution – halfbit Dec 10 '15 at 13:32
  • @halfbit can you please tell in simple english what is the problem ? – yossico Dec 10 '15 at 15:23
  • @yossico: look at the 'gamusinos' and the space on the right – halfbit Dec 10 '15 at 17:14