Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.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 更改按钮响应网页的宽度(bulma)_Html_Css_Bulma - Fatal编程技术网

Html 更改按钮响应网页的宽度(bulma)

Html 更改按钮响应网页的宽度(bulma),html,css,bulma,Html,Css,Bulma,我试图使我的页面响应,我想在移动版的页面改变按钮的宽度,以占据整个页面的宽度。这是桌面版本的外观: 这是手机版的外观: 我不知道如何使用bulma更改按钮,使其占据整个屏幕宽度。这是我的代码: <div className="buttons mt-6 mx-4 is-justify-content-space-between"> <button className="button has-background-link has-

我试图使我的页面响应,我想在移动版的页面改变按钮的宽度,以占据整个页面的宽度。这是桌面版本的外观:

这是手机版的外观:

我不知道如何使用bulma更改按钮,使其占据整个屏幕宽度。这是我的代码:

<div className="buttons mt-6 mx-4 is-justify-content-space-between">
        <button className="button has-background-link has-text-white has-text-weight-bold" style={{ borderRadius: 10 }}>
          <span className="mx-4">Back</span>
        </button>
        <button className="button has-background-primary has-text-white has-text-weight-bold" style={{ borderRadius: 10 }}>
          <span>Go to Basket</span>
        </button>
      </div>

返回
上篮
我已经标记了HTML、CSS和Bulma,因为我不确定以下哪项可以解决这个问题,因为我正在使用Bulma,但这是Bulma反应性的外部问题

#test {
   width: 100%;
   min-width: 50px;  // add this if you want
   max-width: 300px; // add this if  you want, adjust accordingly
}

<div className="buttons mt-6 mx-4 is-justify-content-space-between">
        <button id="test" className="button has-background-link has-text-white has-text-weight-bold" style={{ borderRadius: 10 }}>
          <span className="mx-4">Back</span>
        </button>
        <button id="test" className="button has-background-primary has-text-white has-text-weight-bold" style={{ borderRadius: 10 }}>
          <span>Go to Basket</span>
        </button>
      </div>
#测试{
宽度:100%;
最小宽度:50px;//如果需要,请添加此项
最大宽度:300px;//如果需要添加此项,请进行相应调整
}
返回
上篮
试试这个

#test {
   width: 100%;
   min-width: 50px;  // add this if you want
   max-width: 300px; // add this if  you want, adjust accordingly
}

<div className="buttons mt-6 mx-4 is-justify-content-space-between">
        <button id="test" className="button has-background-link has-text-white has-text-weight-bold" style={{ borderRadius: 10 }}>
          <span className="mx-4">Back</span>
        </button>
        <button id="test" className="button has-background-primary has-text-white has-text-weight-bold" style={{ borderRadius: 10 }}>
          <span>Go to Basket</span>
        </button>
      </div>
#测试{
宽度:100%;
最小宽度:50px;//如果需要,请添加此项
最大宽度:300px;//如果需要添加此项,请进行相应调整
}
返回
上篮

您也可以在CSS中使用@media标记

<style>
/* Default Styling */
.button {
    width: 300px;
}

/* Only applies if the window with is under 600px */
@media only screen and (max-width: 600px) {
    .button {
        width: 100%;
    }
}
</style>

<div className="buttons mt-6 mx-4 is-justify-content-space-between">
    <button className="button has-background-link has-text-white has-text-weight-bold" style={{ borderRadius: 10 }}>
        <span className="mx-4">Back</span>
    </button>
    <button className="button has-background-primary has-text-white has-text-weight-bold" style={{ borderRadius: 10 }}>
        <span>Go to Basket</span>
    </button>
</div>

/*默认样式*/
.按钮{
宽度:300px;
}
/*仅当窗口小于600px时适用*/
@仅介质屏幕和(最大宽度:600px){
.按钮{
宽度:100%;
}
}
返回
上篮

您也可以在CSS中使用@media标记

<style>
/* Default Styling */
.button {
    width: 300px;
}

/* Only applies if the window with is under 600px */
@media only screen and (max-width: 600px) {
    .button {
        width: 100%;
    }
}
</style>

<div className="buttons mt-6 mx-4 is-justify-content-space-between">
    <button className="button has-background-link has-text-white has-text-weight-bold" style={{ borderRadius: 10 }}>
        <span className="mx-4">Back</span>
    </button>
    <button className="button has-background-primary has-text-white has-text-weight-bold" style={{ borderRadius: 10 }}>
        <span>Go to Basket</span>
    </button>
</div>

/*默认样式*/
.按钮{
宽度:300px;
}
/*仅当窗口小于600px时适用*/
@仅介质屏幕和(最大宽度:600px){
.按钮{
宽度:100%;
}
}
返回
上篮