Adding a dotted line trail after menu description

后端 未结 4 1134
轻奢々
轻奢々 2020-12-30 16:21

How would I go about adding a dynamic \"..........\" to a restaurant menu in CSS? Like in printed ones they have the whole \"our food is made of blah blah blah.............

4条回答
  •  执念已碎
    2020-12-30 16:56

    It's possible but not well supported. You want the :after psuedo-selector and the content rule. See here: http://www.quirksmode.org/css/beforeafter.html Note that IE gets a big fat F for implementation.

    You can do it in javascript. Or by creative use of the border-type 'dotted'. Or maybe a repeating background, as Brooks suggests, which would work by giving your price and descriptions spans that you apply a background color to to cover the repeating background.

    Update What that might look like:

    
    

    With CSS like:

    .menu { list-style-type:none;margin: 0 0 0; padding: 0 10px 0; }
    .menu li {
      display:block;
      overflow:hidden; //contain the float
      background-image: url(dots.gif);
      background-repeat:repeat-x;
    }
    .menu .name { background-color:#ffffff; }
    .menu .price { float:right; clear:none; background-color:#ffffff; }
    

提交回复
热议问题