• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

CSS background to repeat left and right

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following CSS property defined for a navigation element:



The image below shows the rendered page. How do I get the dotted line to appear on the right hand side as well? I tried various combinations of the repeat attribute only to make it worse. Any ideas?
Screen-Shot-2014-01-03-at-4.49.58-PM.png
[Thumbnail for Screen-Shot-2014-01-03-at-4.49.58-PM.png]
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why aren't you just using borders rather than background images? I advise to never use a background image when an effect can be achieved with pure CSS.

Then it's a simple matter to define a right border to the last item.

I would also be styling the item, not the link within it.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Why aren't you just using borders rather than background images? I advise to never use a background image when an effect can be achieved with pure CSS.

Then it's a simple matter to define a right border to the last item.

I would also be styling the item, not the link within it.



That was a good suggestion. I removed the image and replaced it with a CSS border and I can now get what I wanted very easily.
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I think a lot of people stick with images for this type of thing out of habit. With modern CSS, you can do a lot without images.
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For example, did you know that you can create the following using just CSS?



See this fiddle to see how.

[Disclaimer: this is not my example; I got the original code from Chris Coyier's most excellent CSS-tricks site.]
 
author
Posts: 297
5
Android Firefox Browser Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My favourite CSS demos at the moment are Ana Tudor's (unfortunately they seem to only work properly in Firefox). Have a look at this video for some explanation of the theory.
 
I don't like that guy. The tiny ad agrees with me.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic