0

Music Player

Consider this image. Here I have a background image(only the outer part of the player not the buttons timing and the progress bar). Now I want to place the play, next, previous and stop buttons in the places exact same places.

#playbuttonimg{
    margin-left:-95px;
    position: absolute;
    top:20px;
}
#pausebuttonimg{
    margin-left:-95px;
    position: absolute;
    top:20px;
    display: none;
}
#prevbuttonimg{
    position: absolute;
    /*margin-left:-15px;*/
    top:24px;
}
#stopbuttonimg{
    position: absolute;
    margin-left:18px;
    top:24px;
}
#nextbuttonimg{
    position: absolute;
    margin-left:50px;
    top:24px;
}

If I use this style, in desktop browser it comes perfectly but in the mobile devices the margin-left being negative makes the button go beyond the screen and the positive margins will be visible but not placed accordingly.

And as it is mobile website it should fit properly in all the mobile devices. How can I do this in css? Is there a way to do it without using media queries? Or is there any other way so that I can make it fit properly across all the mobile devices?

1
  • can you show us the live demo of your code..... Commented May 13, 2013 at 10:25

2 Answers 2

2

You can add a position:relative; to your main parent div.

Sign up to request clarification or add additional context in comments.

Comments

-1

If you work with percentage values this should work, I mean you have used

margin-left:xxxpx; 

in pixels, but if you can calculate its percentage values, this may solve.

For the calculations you can get help of http://resources.sameerast.com/responsive-web-design-formula-easy-calculator.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.