The Basics of What You'll Need for Responsive Web Design
You know HTML.You know CSS.
You don't know Responsive design.
It's easy to understand.
Use CSS to Define Different Screen Styles
Start with a default style, then go from widest to narrowest
First, you'll make a default style sheet.
- Create a CSS3 style sheet just like you normally would.
Then, at the bottom of the CSS, you will define specific styles for different screen sizes. These styles could be either new, additional definitions, or they could override the default definitions.
So, the logic goes something like this:
- Default style definitions (for all screen sizes)
- Very wide styles (between x and y pixels)
- Medium width styles (between y-1 and z)
- Narrow width styles (anything smaller than z-1)
The code will be structured like this:
<style>
/* 1. SPECIFY DEFAULT STYLE HERE */
/* FOLLOWED BY DESCENDING WIDTHS OF
SCREEN SIZE STYLES, LIKE THIS: */
@media screen and (max-width: x) and (min-width: y) {
/* 2. SPECIFY WIDE STYLES HERE */
}
@media screen and (max-width: y-1) and (min-width: z) {
/* 3. SPECIFY MEDIUM STYLES HERE */
}
@media screen and (max-width: z-1) {
/* 4. SPECIFY NARROW STYLES HERE */
}
</style>
-----
That's it.
Now you mix-n-match CSS styles to make elements realign themselves, disappear or become visible, change font sizes and colors, etc.
-----
This working example of code changes the color and size of the headline when the screen width changes.
See the working example.
<style>
/* DEFAULT (ALL SCREEN SIZES) */
h1 {
color: green;
font-size: 2em;
}
/* SCREEN WIDTH BETWEEN 767 AND 600 PIXELS */
@media screen and (max-width: 767px) and (min-width: 600px) {
h1 {
color:blue;
font-size: 1.75em;
}
}
/* SCREEN WIDTH BETWEEN 599 AND 480 PIXELS */
@media screen and (max-width: 599px) and (min-width: 480px) {
h1 {
color:orange;
font-size: 1.5em;
}
}
/* ANY SCREEN WIDTH BELOW 480 PIXELS */
@media screen and (max-width: 479px) {
h1 {
color:red;
font-size: 1.25em;
}
}
</style>
<style>
/* 1. SPECIFY DEFAULT STYLE HERE */
/* FOLLOWED BY DESCENDING WIDTHS OF
SCREEN SIZE STYLES, LIKE THIS: */
@media screen and (max-width: x) and (min-width: y) {
/* 2. SPECIFY WIDE STYLES HERE */
}
@media screen and (max-width: y-1) and (min-width: z) {
/* 3. SPECIFY MEDIUM STYLES HERE */
}
@media screen and (max-width: z-1) {
/* 4. SPECIFY NARROW STYLES HERE */
}
</style>
-----
That's it.
Now you mix-n-match CSS styles to make elements realign themselves, disappear or become visible, change font sizes and colors, etc.
-----
This working example of code changes the color and size of the headline when the screen width changes.
See the working example.
<style>
/* DEFAULT (ALL SCREEN SIZES) */
h1 {
color: green;
font-size: 2em;
}
/* SCREEN WIDTH BETWEEN 767 AND 600 PIXELS */
@media screen and (max-width: 767px) and (min-width: 600px) {
h1 {
color:blue;
font-size: 1.75em;
}
}
/* SCREEN WIDTH BETWEEN 599 AND 480 PIXELS */
@media screen and (max-width: 599px) and (min-width: 480px) {
h1 {
color:orange;
font-size: 1.5em;
}
}
/* ANY SCREEN WIDTH BELOW 480 PIXELS */
@media screen and (max-width: 479px) {
h1 {
color:red;
font-size: 1.25em;
}
}
</style>
This information that you have given in your article, is quite useful and it's given me a piece of good knowledge on Web Design. Thanks for giving this information. Ecommerce Website Design Company USA
ReplyDeleteI am happy to find this post very useful for me, as it contains a lot of information. I always prefer to read the quality content and this thing I found in your post. Thanks for sharing it. Website Design Point Cook
ReplyDeleteYou shared an impressive and informative blog here about web designing. I like your blog. Thanks for sharing. Miami web design
ReplyDeletekeep sharing your information regularly for my future reference. This content creates new hope and inspiration within me. Thanks for sharing an article like this. The information which you have provided is better than another blog. Website development company in Canada visit our website.
ReplyDeleteThis content creates new hope and inspiration for everyone. keep sharing your information regularly for my future reference. Thanks for sharing an article like this responsive website design services in UK for more info visit at insignalmedia.com
ReplyDeleteYou write this post very carefully I think, which is easily understandable to me. Not only this, but another post is also good. As a newbie, this info is really helpful for me. Thanks to you. As we provide Professional Web Design Services Ireland then visit our website at Developit.ie
ReplyDeleteI am continually searching for some free stuffs over the web.I ought to thank you for posting this blog because the subject is especially looked by everyone. Get the best info about Local Web Design Company in Chicago then visit our website at allevi8marketing.com
ReplyDeleteAppealing, post. I just unearthed Your weblog and needed to state that I have loved perusing your blog entries. All things considered, I will without a doubt buy in to your feed, and I trust you will compose again soon! website design vancouver wa
ReplyDeleteI got information from your article which I will be sharing with my friends who will need this information. I will suggest reading this article because it will really help those who need this information. Thanks for the information which you have shared here. web design services in UK
ReplyDeletecontinue sharing your data routinely for my future reference. This substance makes new desire and inspiration inside me. Thankful for sharing this article here. Web Developer Malaysia
ReplyDeleteThanks for sharing this article here about the Best IT Support Services. Your article is very informative and I will share it with my other friends as the information is really very useful. Keep sharing your excellent work.Best IT Support Services Auckland
ReplyDeleteThanks for sharing the best information and suggestions, it is very nice and very useful to us. I appreciate the work that you have shared in this post. Keep sharing these types of articles here. small business phone service
ReplyDeleteThanks for posting such informative article in this post about it services . I got some great knowledge from this post.https://www.telxcomputers.com/ Keep it up.
ReplyDeleteThanks for sharing the best information and suggestions, it is very nice and very useful to us. I appreciate the work that you have shared in this post. Keep sharing these types of articles here. DLS Internet Services
ReplyDeleteI am very thankful to you for sharing this necessary knowledge. This information is very helpful for everyone. So please always share this kind of information. Thanks. microsoft support houston tx
ReplyDeleteThis is really such an explanatory post you have shared here about web designing. I got some useful knowledge from this post.online b2b travel platform development. Thanks for sharing it.
ReplyDeleteI generally check this kind of article and I found your article which is related to my interest. Genuinely, it is good and instructive information about network solution.It Support Houston. Thanks for sharing an amazing article here.
ReplyDeleteI admire this article for the well-researched content and excellent wording. Read more info about it support company in houston. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much.
ReplyDeleteExcellent post. I really enjoy reading and also appreciate your work.Host your website in Free USA This concept is a good way to enhance knowledge. Keep sharing this kind of articles, Thank you.
ReplyDeleteI generally check this kind of article and I found your article which is related to my interest.it outsourcing Genuinely it is good and instructive information. Thankful to you for sharing an article like this.
ReplyDeleteI will share it with my other friends as the information is really very useful. web design dubai. Keep sharing your excellent work.
ReplyDeleteInteresting to read your post about the responsive web design. I can't wait to see your next post. Good luck for upcoming updates.
ReplyDeletewebsite design company
Thanks for sharing tips for designing the responsive website..
ReplyDeleteI am web designer and can understand the value of these trends for me… your tips will really help me to make effective website design…
Law firm website design by split reef