如何使用 css 和
  • 制作一个 1 到 50 像素的无边框正方形
  • 发布于 2024-09-15 02:28:28 字数 1144 浏览 1 评论 0原文

    我想使用 a 中不同大小的正方形来制作饼形状,但是我在使用 css 时遇到了麻烦,无法制作一个高度和宽度均为一像素且没有边框的正方形。这是我当前的 css

    #q-graph {position: relative; width: 300px; height: 300px;  margin: 1.1em 0 3.5em; padding: 0;  background: #DDD;  border: 2px solid gray; list-style: none;  font: 9px Helvetica, Geneva, sans-serif;}
    #q-graph ul {margin: 0; padding: 0; list-style: none;}
    #q-graph li {position: absolute; bottom: 0; width: 150px; z-index: 2;  margin: 0; padding: 0;  text-align: center; list-style: none;}
    #q-graph li.bar {position: absolute; width: 1px; height: 1px; border: none }
    #q-graph li.bar p {margin: 5px 0 0; padding: 0;}
    

    ,这是我想要的一些帮助

    <ul id="q-graph">
    
    <a href='blah.com'><li class='bar' style='left:2px; top:126px; width:37px; height:37px; background:blue;border-color:blue;'></li></a>
    <a href='blah.com'><li class='bar' style='left:9px; top:164px; width:37px; height:37px; background:blue;border-color:blue;'></li></a>
    

    ,因为我的 CSS 技能似乎不足以完成这项任务。

    这就是目前的样子

    I'd like to use different sized squares from a to make pie shapes, but I'm having trouble with the css to make a square one pixel in height and width with no borders. Here is my current css

    #q-graph {position: relative; width: 300px; height: 300px;  margin: 1.1em 0 3.5em; padding: 0;  background: #DDD;  border: 2px solid gray; list-style: none;  font: 9px Helvetica, Geneva, sans-serif;}
    #q-graph ul {margin: 0; padding: 0; list-style: none;}
    #q-graph li {position: absolute; bottom: 0; width: 150px; z-index: 2;  margin: 0; padding: 0;  text-align: center; list-style: none;}
    #q-graph li.bar {position: absolute; width: 1px; height: 1px; border: none }
    #q-graph li.bar p {margin: 5px 0 0; padding: 0;}
    

    and here is a bit of the pie slice

    <ul id="q-graph">
    
    <a href='blah.com'><li class='bar' style='left:2px; top:126px; width:37px; height:37px; background:blue;border-color:blue;'></li></a>
    <a href='blah.com'><li class='bar' style='left:9px; top:164px; width:37px; height:37px; background:blue;border-color:blue;'></li></a>
    

    I'd like help with this as my CSS skills seem to be inadequate for the task.

    This is what it looks like at the moment

    如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

    扫码二维码加入Web技术交流群

    发布评论

    需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

    评论(1

    公布 2024-09-22 02:28:28

    嗯,你的问题的答案可能是
    “删除‘宽度:37px;高度:37px;’来自你的内联CSS。”

    Well, the answer to your question would probably be
    "Remove the 'width:37px; height:37px;' from your inline css."

    ~没有更多了~
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文