html - 为移动 View 正确设置 CSS 样式?

标签 html css

我目前如何设置所有元素的样式:

#pandora {
  position: absolute;
  top: 63%;
  left: 51.5%;
  width: 9%;
}

#tidal {
  position: absolute;
  top: 68%;
  left: 40.5%;
  width: 5%;
}

问题是,这是我在关注我的百分比,我认为这并没有针对移动设备(我需要)进行优化。那么,我应该如何正确设置元素的样式?

最佳答案

请点击以下链接练习 bootstrap。

https://www.w3schools.com/bootstrap/bootstrap_grid_system.asp

对于响应式网站,您需要学习 Bootstrap 的网格系统。它是 Bootstrap 中最重要的部分。 网格系统使您的系统布局响应迅速。

但是,也需要媒体查询。有时你的内部数据在响应式布局中看起来不太好。届时您需要使用媒体查询来设计外观更好的网站。

下面是一些媒体查询,你可以根据设备大小放置你的CSS代码。

<style>

/* Extra small devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {  

   /* Your CSS Code for this device size */    

  }

/* Small devices (portrait tablets and large phones, 600px and up) */
@media only screen and (min-width: 600px) {  

   /* Your CSS Code for this device size */    

}

/* Medium devices (landscape tablets, 768px and up) */
@media only screen and (min-width: 768px) {  

   /* Your CSS Code for this device size */    

} 

/* Large devices (laptops/desktops, 992px and up) */
@media only screen and (min-width: 992px) {  

   /* Your CSS Code for this device size */    

}      

/* Extra large devices (large laptops and desktops, 1200px and up) */
@media only screen and (min-width: 1200px) {

   /* Your CSS Code for this device size */ 

}

/* According to Mobile Orientation */
@media only screen and (orientation: landscape) {   

   /* Your CSS Code for this device orientation */    

}

关于html - 为移动 View 正确设置 CSS 样式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57566512/

相关文章:

css - 在 firefox/IE 中透明 .png 图像覆盖另一个图像的问题

html - CSS 背景颜色显示另一种颜色

javascript - 2 列列表行 CSS JS 上的高度相同

javascript - 一些 TD 移动到新行后的多个 TD

基于 body ID 的 jquery 事件状态

html - 实时不显示图标

html - CSS3 :not() selector Issue with child elements

javascript - 如何使用html和css填充空白

jquery - 每当我在 jQuery 中添加其他值时,如何每次刷新总值?

javascript - 单击图像时 nivo-lightbox 未启动