Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html Bootstrap更改边距_Html_Css_Margin - Fatal编程技术网

Html Bootstrap更改边距

Html Bootstrap更改边距,html,css,margin,Html,Css,Margin,当内容显示在移动设备上时,是否有办法更改屏幕左右两侧的内容边距? 因此,内容在桌面上有边距,而在手机上没有边距。 有什么想法吗?是的,使用媒体查询。对于媒体查询,您可以说,在屏幕的某个宽度上,应该激活某个css。例如,当屏幕宽度不超过400px时,应将字体大小恢复为10px。请使用以下代码作为示例进行尝试: @media screen and (max-width: 400px){ p{ font-size: 10px; } } 祝你好运 正如Casper已经说

当内容显示在移动设备上时,是否有办法更改屏幕左右两侧的内容边距? 因此,内容在桌面上有边距,而在手机上没有边距。
有什么想法吗?

是的,使用媒体查询。对于媒体查询,您可以说,在屏幕的某个宽度上,应该激活某个css。例如,当屏幕宽度不超过400px时,应将字体大小恢复为10px。请使用以下代码作为示例进行尝试:

@media screen and (max-width: 400px){
    p{
        font-size: 10px;
    }
}

祝你好运

正如Casper已经说过的,你需要使用媒体查询,El Devoper给了你链接。如果你使用bootstrap,也许你必须使用
!重要信息
覆盖引导的默认属性

@media screen and (max-width: 320px){
    p{
        margin-left: 10px !important
        margin-right: 10px !important
        //or just use "margin: 0 10px !important" to set margins like this:
        //top and bottom = 0, left and right = 10px
    }
}
希望对媒体查询有所帮助

当然可以。