Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Semrush - keyword research tool

Create your online store today with Shopify

Turn ChatGPT, Claude, Gemini, And CoPilot Into Your Personal Assistant, Business Coach, Content Creator, And More

AFFILIATE MARKETING Your all-in-one performance engine Manage affiliates, creators, and customer referrals in one unified platform—turning every partnership into measurable growth

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Disclosure: My content contains affiliate links.

43,121 questions

55,995 answers

573 users

How to use @media screen to define different style for different browser size for responsive web page in HTML and CSS

1 Answer

0 votes
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
* {
  box-sizing:border-box;
}

.left {
  background-color:blue;
  padding:10px;
  float:left;
  width:25%; 
}

.center {
  background-color:lightgray;
  padding:10px;
  float:left;
  width:50%;
}

.right {
  background-color:red;
  padding:10px;
  float:left;
  width:25%; 
}

@media screen and (max-width:800px) {
  .left, .center, .right {
    width:100%; 
  }
}
</style>
</head>
<body>

<div class="left">
  <p>Left</p>
</div>

<div class="center">
  <p>Center</p>
</div>

<div class="right">
  <p>Right</p>
</div>

</body>
</html>

 



answered Dec 29, 2018 by avibootz
...