Rounded corner, rectangle buttons

2019-02-25 19:08发布

I am interested in making an html button similar to the ones found on the homepage of https://new.myspace.com/. I know that the html would look like this:

 <button class="button" id="join">Join</button>

Although I'm not sure on what the css should look like. I know there are many tutorials online about html buttons, but I'm not sure about semi-rectangular ones. Thanks, Harrison

标签: html css button
3条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-02-25 19:32

Here's a little info on border-radius: http://www.css3.info/preview/rounded-border/

And here's a cool little generator to make things easy: http://border-radius.com/

查看更多
一纸荒年 Trace。
3楼-- · 2019-02-25 19:35

Use border-radius. The exact code in that example is border-radius: 4px; https://developer.mozilla.org/en-US/docs/CSS/border-radius

Following Jake's good advices, use this catch-all-browser rules:

button#join {
    -moz-border-radius: 4px;
    -webkit-border-radius: 4px;
    border-radius: 4px;
}
查看更多
相关推荐>>
4楼-- · 2019-02-25 19:38

Try:

<button class="button" id="join">Join</button>

Css:

.button {
    /*adjust the roundness*/
    border-radius: 4px;
    moz-border-radius: 4px;
    webkit-border-radius: 4px;
    /*adjust height and width*/
    height: 20px;
    width: 20px; 
    /*change border colour*/
    border:1px #245ec6 solid;
}

Adjust the amount of pixels the border radius property is in order to change how much it is rounded.

Edit: apparently the website you posted uses 4px (code adjusted)

Second edit: Adjustments made to the code to make larger buttons and to effect all buttons.

查看更多
登录 后发表回答