November 22, 201015 yr I have a really silly problem which is annoying and wondered if anyone could help. I am currently working on this web site: http://www.lucky-magpies.co.uk/lifestyle/ and as you can see, the text on the buttons on the left hand side don't look quite right. I want the text such as 'Home' to be centralized (between top and bottom) but I cannot find away to do this as it messes up the text which is on 2 lines such as 'Personal Training and Group Exercise' Anyone know of a way I can have a custom align for each of the buttons, rather than applying a style to all? Or perhaps a different way althogether, feel free to look a source code, or I can post it if needed. Many thanks, Sophie
November 22, 201015 yr Say the div is 100px tall. You set the line-height the same. This the vertically aligns the text. Quick bit of CSS to demonstrate: .myDiv { width: 100px; height: 100px; line-height: 100px; } Simples!
November 23, 201015 yr you need to check this http://cssproperty.com Perhaps you may get css tutorial.
November 23, 201015 yr Author Say the div is 100px tall. You set the line-height the same. This the vertically aligns the text. Quick bit of CSS to demonstrate: .myDiv { width: 100px; height: 100px; line-height: 100px; } Simples! Thanks very much for that, I think there is an issue with the fact some of the text is on 2 lines though. When I put the line height the same as the block height like you mention, the second half of the text disappears. Anyway you think I can rectify this?
November 23, 201015 yr Yeh you'll want to use padding instead. To get it uniform you may want to apply a different method of making your buttons. Maybe progressively enhance to achieve your gradients. Lost the gradients and rounded corners altogether. Create a lot of mark up and images and do it the old fashioned way. Use a sprite with all those images and create a lot of markup. The markup would be something like this. <ul> <li> <span class="top-left"></span> <span class="top-right"></span> <a href="#">This will be a link, probably wrapping two or three lines.</a> <span class="btm-left"></span> <span class="btm-left"></span> </li> <li> <span class="top-left"></span> <span class="top-right"></span> <a href="#">This will be a link, probably wrapping two or three lines.</a> <span class="btm-left"></span> <span class="btm-left"></span> </li> <li> <span class="top-left"></span> <span class="top-right"></span> <a href="#">This will be a link, probably wrapping two or three lines.</a> <span class="btm-left"></span> <span class="btm-left"></span> </li> </ul> CSS li { position: relative; width: width of your button; text-align: center; padding: 10px 5px; background-image: gradient; background-repeat: repeat-x; background-color: #match the bottom colour from your gradient; } span { position: absolute; } .top-left { top: 0; left: 0; height: 5px; width: 5px; background-image: url(top-corner.png); } .top-right { top: 0; right: 0; height: 5px; width: 5px; background-image: url(top-corner.png); } .btm-left { bottom: 0; left: 0; height: 5px; width: 5px; background-image: url(bottom-corner.png); } .btm-right{ bottom: 0; right: 0; height: 5px; width: 5px; background-image: url(bottom-corner.png); } If you Google "Sampson video tutorials" you will find a tidy video tutorial somewhere on this technique.
November 23, 201015 yr Author Yeh you'll want to use padding instead. To get it uniform you may want to apply a different method of making your buttons. Maybe progressively enhance to achieve your gradients. Lost the gradients and rounded corners altogether. Create a lot of mark up and images and do it the old fashioned way. Use a sprite with all those images and create a lot of markup. The markup would be something like this. <ul> <li> <span class="top-left"></span> <span class="top-right"></span> <a href="#">This will be a link, probably wrapping two or three lines.</a> <span class="btm-left"></span> <span class="btm-left"></span> </li> <li> <span class="top-left"></span> <span class="top-right"></span> <a href="#">This will be a link, probably wrapping two or three lines.</a> <span class="btm-left"></span> <span class="btm-left"></span> </li> <li> <span class="top-left"></span> <span class="top-right"></span> <a href="#">This will be a link, probably wrapping two or three lines.</a> <span class="btm-left"></span> <span class="btm-left"></span> </li> </ul> CSS li { position: relative; width: width of your button; text-align: center; padding: 10px 5px; background-image: gradient; background-repeat: repeat-x; background-color: #match the bottom colour from your gradient; } span { position: absolute; } .top-left { top: 0; left: 0; height: 5px; width: 5px; background-image: url(top-corner.png); } .top-right { top: 0; right: 0; height: 5px; width: 5px; background-image: url(top-corner.png); } .btm-left { bottom: 0; left: 0; height: 5px; width: 5px; background-image: url(bottom-corner.png); } .btm-right{ bottom: 0; right: 0; height: 5px; width: 5px; background-image: url(bottom-corner.png); } If you Google "Sampson video tutorials" you will find a tidy video tutorial somewhere on this technique. O.K I was being a little lazy avoiding the 'old fashioned way' but will give it a go now, thanks so much for you're help
Create an account or sign in to comment