简体   繁体   中英

CSS media queries for floating grid columns?

I've been tasked with making an existing website responsive. It's using a bootstrap style grid system and is quite a mess. The following is a snippet of code.

<div class="col-1 col-2 col-3">
  <div class="left">Left Column</div>
</div>

<div class="col-1 col-2 col-3">
  <div class="right">Right Column</div>
</div>

I can add media queries but because the "left" and "right" columns have both been wrapped in these column creating divs, with existing widths applied . What's the best semantic way of rewriting the code (while keeping all the existing column styles), so that I can apply my own styles using media queries?

You can add an id to them

<div id="left" class="col-1 col-2 col-3">
  <div class="left">Left Column</div>
</div

<div id="right" class="col-1 col-2 col-3">
  <div class="right">Right Column</div>
</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM