- This topic is empty.
-
AuthorPosts
-
February 2, 2014 at 9:26 am #161666dc006Participant
Hello,
i have some css challenge here. To describe what Iam after is challenge as well :)
I need text title that will align in the middle of DIV container. The title needs to have a background image that will apply to its left side and different background image that will apply to its right side. The background behind the TITLE text must be transparent.
~~~~bg image1~~~~ TITLE ~~~~bg image2~~~~
The width of DIV container varies as well as the TITLE text length.
I’ve tried to apply content with :before and :after markup h1 {margin: 0 auto;display: table;} h1:before {content: url(‘image_left.png’);} h1:after {content: url(‘image_right.png’);}
however this does not work for me as the width of content :before and :after equals to the width of image and I can not figure out how to make it responsive.
Any hints appreciated :)
February 2, 2014 at 6:25 pm #161701SorenParticipantI’m not sure if this helps in any way but I had a little play
February 3, 2014 at 12:28 am #161721dc006ParticipantHey Soren, thank you for suggested approach.
I’ve already played with :before and :after statement this way, however as you pointed the problem with this approach is that the width must be defined.
I need the background on each side to take up all remaining width and keep it responsive as well. Here is the link with some images of what Iam trying to achieve:February 3, 2014 at 6:18 am #161747dc006ParticipantI’ve put my code on CodePen for better idea on what Iam after. http://codepen.io/dc006/pen/BupmF
February 3, 2014 at 7:12 am #161750chrisburtonParticipantClosest that I could get
February 3, 2014 at 8:25 am #161755dc006Participantchrisburton good work however the width of container is not fluid in your code. Further more the text withinn h1 will will change dynamically on the site (this will hold the page title and we never know the length of title text) so I can not define width of h1 and negative position of h1:before … and so on.
February 3, 2014 at 9:36 am #161760SorenParticipantgood luck with this one, dc006 :)
Could you post the solution when you find it, please? I’m intrigued.
February 4, 2014 at 12:28 am #161794dc006ParticipantWhohoo wolfcry911 you are the King! Thank you for posting this solution.
Have a good day.February 4, 2014 at 12:34 am #161795chrisburtonParticipantNice work, @wolfcry911
February 4, 2014 at 8:27 am #161826SorenParticipantAgreed.
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.