- This topic is empty.
-
AuthorPosts
-
October 30, 2014 at 3:59 pm #187373aftabn10Participant
Hi, I am looking for some help in creating a navigation with image separators with pseudo elements.
An example of a menu that I would like is shown below:
(image1(separator) HOME (image2(separator) ABOUT US (image2(separator) PRODUCTS (image2(separator) CONTACT US (image3(separator)
Apologies as I have written on code or css, just trying to get some help in how i can achieve this using pseudo elements as never used them before.
If somebody could show me an example on how i can achieve this, would really appreciate it.
Thanks in advance
October 31, 2014 at 2:42 am #187400Paulie_DMemberYou can make the menu in Codepen.io without the separators can’t you?
We can deal with the pseudo elements after we see what you have so far.
A quick search on this site will find a lot of what you are after.
October 31, 2014 at 4:26 am #187409aftabn10ParticipantThanks Paulie_D, I have created a menu in codepen at the following location:
http://codepen.io/anon/pen/sjfHJ
Thanks once again for all your help.
October 31, 2014 at 4:55 am #187411stefan_rakietaParticipantI still don’t have clue what do you want to do with it. If you don’t want the first element to be separated from the border of the screen when you put margin in all of those elements just use
:first-child
pseudo element and give itmargin: 0px
October 31, 2014 at 5:39 am #187413JimmyParticipantwithout giving away too much, could the code for spacing using pseudo elements involve
:nth-child(n+1)
? I am trying to learn through talking in the forums =POctober 31, 2014 at 5:54 am #187414Paulie_DMemberI’d go something like this
http://codepen.io/Paulie-D/pen/qtmzC
The red area is where you put the separator image as a background image and using background positioning and sizing as appropriate/required.
The size of the separator area is entirely up to you you just have to change the padding acccordingly.
It’s not the only way, you could put the separators after the
li
rather than the anchors` but there’s not a lot in it…to my mind.October 31, 2014 at 7:59 am #187427aftabn10ParticipantThanks guys for your responses. Apologies as doesnt sound very clear as to what i require.
Paulie_D, the example you have showed is what I require, but on top of that I would like to have another image before the home button and a 3rd image that is used after the contact button.
Like:
black area HOME red area ABOUT US red area …CONTACT green area
Hope thats a bit more clearer.
Thanks once again for all your help guys
October 31, 2014 at 8:03 am #187428Paulie_DMemberSimple enough, you can use another pseudo element (::before) for those list items using the same techniques.
Try it…if you have any issues, come back.
October 31, 2014 at 8:42 am #187430aftabn10ParticipantThanks Paulie_D, I edited my original pencode with your code and the additional code for the first-child and last-child.
http://codepen.io/anon/pen/sjfHJ
Just going try this with the background images now.
Thanks once again.
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.