How to make a link appear as a normal link in one screen size, as a button in another?
Annoyingnewbie’s Question:
I’m programming a website with three different sizes for desktop, netbook and mobile phone systems.
On the main page I have a click-thru html link of the
<a href="more.html">Find out more</a>
variety.
What I want is to change this to a button for mobile screens, like a conditional statement or something.
Any ideas?
Thanks
Use media queries. They can help you target type of screen and based on its width. For example
@media only screen and (min-device-width: 300px) and (max-device-width: 480px) {
/* Now you can write a different style of elements on a screen with maximum 300px as width */
a {
color: #f00; /* Make link appear red on mobile screen */
/* make it should like a button */
border: 1px #c00 solid;
background: #ddd;
}
}
Note: Media Queries are CSS3 features, and will not work in earlier version of IE.