html - 我如何在 CSS 中制作完整的胶囊

标签 html css

我正在尝试在 css 中创建完整的胶囊,但我没有得到预期的结果。任何人都可以帮我解决这个问题。我是 css 的新手

以下是我的代码:

<style>
    #myStyle {
        position: relative;
        width: 60px; 
        height: 101px; 
        background: #f5d540;
        border-top-left-radius: 183px 150%;
        border-top-right-radius: 201px 147%;
    }
    #myStyle:after {
        position: absolute;
        bottom: 0;
        display: block;
        content: '';
        width: 60px;
        height: 44px;
        border-radius: 44px 44px 0 0;
        background: white;
    }

</style>
<body ng-app="">
    <p> Insert Some text in the Text Field </p>
    <p> Enter The Text <input type="text" ng-model="name" placeholder="Enter the Name"> </p>
    <h1> Hi {{name}}</h1>
<div class="myStyle" id="myStyle">
    <h5 style="text-align:center;padding-top: 10px;"></h5>
</div>
</body>

预期结果:

enter image description here

实际结果:

enter image description here

最佳答案

  #myStyle { 
    background: red;
    border: 1px solid #94c640;
    box-shadow: none;
    color: #ffffff;
    border-radius: 15px;
    padding: 5px 10px;
 }

这将创建一个胶囊

关于html - 我如何在 CSS 中制作完整的胶囊,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42242623/

相关文章:

jquery - 如何使用 css3 flexbox 和 jquery 创建文件上传按钮?

javascript - 使用 Div 和 .load 显示图像

html - 如何使图例扩展字段集的整个宽度并保持内容填充?

html - 使用什么技术来显示这些优雅的可点击选项?

javascript - 如何获取 kendo MVVM 的选定名称元素

javascript - 如何动态改变 ion-content 位置?是否可以?

html - 使 flex div 的宽度适应内容,但将 Flex 元素放在单独的行中

html - 减少链接的可点击区域

html - Angular 中的羽毛笔编辑器 (editor.root.innerHTML)

html - 如何在 CSS 中制作带有对 Angular 线网格的响应式菜单?