Html 使用css边框指向窗体角点

Html 使用css边框指向窗体角点,html,css,border,Html,Css,Border,我正在努力与CSS在做上述角落,如图所示 我努力尝试,得到了这个,但无法得到完美的角落与CSS 我试着创建一个较大的绿色三角形,然后创建一个较小的白色三角形来获得那种外观 HTML代码: <div id="loginmain"> <div id="login" class="login_hover"> </div> <div id="login-content" class="triangle-border top" style="">

我正在努力与CSS在做上述角落,如图所示

我努力尝试,得到了这个,但无法得到完美的角落与CSS

我试着创建一个较大的绿色三角形,然后创建一个较小的白色三角形来获得那种外观

HTML代码:

    <div id="loginmain">
<div id="login" class="login_hover">

</div>
<div id="login-content" class="triangle-border top" style="">
    <form onsubmit="loginAjax(); return false;" method="POST" _lpchecked="1">
        <div><lable>Username</lable><input name="username" id="username" type="text"></div>
        <div><lable>Password</lable><input name="password" id="password" type="password"></div>
        <a class="sign-up left clear">Sign Up</a>
        <a class="forgot">Forgot Password?</a>
        <input name="login" type="submit" value="Sign In">
    </form>

</div>
</div>

请为同样的问题提出一个解决方案。

我宁愿使用IMG,也不愿对实际三角形进行编码。

我宁愿使用IMG,也不愿对实际三角形进行编码。

像这样,我知道这不是一个完美的方法,但我可以完善你的答案。如果你喜欢这个,请用这个。您有迫切需要的解决方案,请尝试此解决方案

CSS

#login {
    background: url("../imgs/icons/user_border.png") repeat scroll 0 0 / contain transparent;
    border: 1px solid red;
    cursor: pointer;
    height: 47px;
    position: absolute;
    right: -59px;
    text-align: right;
    top: 18px;
    width: 53px;
}
#login:hover , .login_hover {
    background: url(../imgs/icons/user.png) !important;
    z-index:9999;

}
.arrow {
    background-image: url("http://satyamsteelvadodara.com/img/green-arrow.png");
    background-repeat: no-repeat;
    height: 15px;
    margin: 64px 0 0 42px;
    position: absolute;
    right: 0;
    width: 21px;
    z-index: 100;
}


.triangle-border {
    position:relative;
    padding:8px;
    margin:1em 0 3em;
    border:2px solid #44C544;
    color:#333;
    background:#fff;
    /* css3 */
    -webkit-border-radius:10px;
    -moz-border-radius:10px;
    border-radius:10px;
}

/* Variant : for left positioned triangle
------------------------------------------ */

.triangle-border.left {
    margin-left:30px;
}

/* Variant : for right positioned triangle
------------------------------------------ */

.triangle-border.right {
    margin-right:30px;
}

/* THE TRIANGLE
------------------------------------------------------------------------------------------------------------------------------- */
.triangle-border:before{
  /*  width: 0; 
    height: 0; 
    border-top: 0 solid transparent;
    border-bottom: 0 solid transparent;

    border-left: 60px solid white;*/
    background-image:url(http://satyamsteelvadodara.com/img/green-arrow.png);




}
.triangle-border1:before {
    content:"";
    position:absolute;
    bottom:-20px; /* value = - border-top-width - border-bottom-width */
    left:40px; /* controls horizontal position */
    border-width:20px 20px 0;
    border-style:solid;
    border-color:#00B100 transparent transparent #00B100 ;
    /* reduce the damage in FF3.0 */
    display:block; 
    width:0;
}

/* creates the smaller  triangle */
.triangle-border:after {
   /* content:"";
    position:absolute;
    bottom:-13px; /* value = - border-top-width - border-bottom-width */
    /*left:47px; /* value = (:before left) + (:before border-left) - (:after border-left) */
    border-width:13px 13px 0;
    border-style:solid;
     border-color:#00B100 transparent transparent #00B100 ;
    /* reduce the damage in FF3.0 */
    display:block; 
    width:0;
}

/* Variant : top
------------------------------------------ */

/* creates the larger triangle */
.triangle-border.top:before {
    top:-20px; /* value = - border-top-width - border-bottom-width */
    bottom:auto;
    left:auto;
    right:10px; /* controls horizontal position */
    border-width:0 15px 20px;
}

/* creates the smaller  triangle */
.triangle-border.top:after {
    top:-15px; /* value = - border-top-width - border-bottom-width */
    bottom:auto;
    left:auto;
    right:10px; /* value = (:before right) + (:before border-right) - (:after border-right) */
    border-width:0 15px 20px;
}

/* Variant : left
------------------------------------------ */

/* creates the larger triangle */
.triangle-border.left:before {
    top:10px; /* controls vertical position */
    bottom:auto;
    left:-30px; /* value = - border-left-width - border-right-width */
    border-width:15px 30px 15px 0;
    border-color:transparent #5a8f00;
}

/* creates the smaller  triangle */
.triangle-border.left:after {
    top:16px; /* value = (:before top) + (:before border-top) - (:after border-top) */
    bottom:auto;
    left:-21px; /* value = - border-left-width - border-right-width */
    border-width:9px 21px 9px 0;
    border-color:transparent #fff;
}

/* Variant : right
------------------------------------------ */

/* creates the larger triangle */
.triangle-border.right:before {
    top:10px; /* controls vertical position */
    bottom:auto;
    left:auto;
    right:-30px; /* value = - border-left-width - border-right-width */
    border-width:15px 0 15px 30px;
    border-color:transparent #5a8f00;
}

/* creates the smaller  triangle */
.triangle-border.right:after {
    top:16px; /* value = (:before top) + (:before border-top) - (:after border-top) */
    bottom:auto;
    left:auto;
    right:-21px; /* value = - border-left-width - border-right-width */
    border-width:9px 0 9px 21px;
    border-color:transparent #fff;
}

#login-content {
position: absolute;
top: 60px;
right:10px;
width: 290px;
color: #848484;
z-index: 9;
padding: 13px;
}

#login-content a { width: 100%; display: block; }
#login-content lable {
    padding-right:10px;
    width: 30%;
    display: inline-block;
}
#login-content div {
    margin-top: 10px;
}
#login-content input[type=text] ,#login-content input[type=password] {
   width: 58%;
   height: 25px;
   border: 1px solid #A6A6A6;
   font-size:12px;
   }
#login-content input[type=text]:focus ,#login-content input[type=password]:focus {  
  border: 1px solid rgba(4, 213, 4, 1);
 }
 #login-content a.forgot {
        float:right;
        font-size:12px;
        cursor: pointer;
        margin-top: 5px;
        color:#848484;
 }  
 #login-content .sign-up{
    position: absolute;
    bottom: 15px;
    font-weight: normal;
    display: none;
 }
#login-content input[type=submit] {
    clear: both;
    margin-top: 10px;
    float: right;
    cursor: pointer;
    font-size: 15px;
    padding:5px 10px;
} 
HTML

    <div id="loginmain">
<div id="login" class="login_hover">

</div>
           <div class="arrow"></div>
<div id="login-content" class="triangle-border top" style="">
    <form onsubmit="loginAjax(); return false;" method="POST" _lpchecked="1">
        <div><lable>Username</lable><input name="username" id="username" type="text"></div>
        <div><lable>Password</lable><input name="password" id="password" type="password"></div>
        <a class="sign-up left clear">Sign Up</a>
        <a class="forgot">Forgot Password?</a>
        <input name="login" type="submit" value="Sign In">
    </form>

</div>
</div>

用户名
密码
注册
忘记密码了?

像这样,我知道这不是一个完美的方法,但我会完善你的答案。如果你喜欢这个,请用这个。您有迫切需要的解决方案,请尝试此解决方案

CSS

#login {
    background: url("../imgs/icons/user_border.png") repeat scroll 0 0 / contain transparent;
    border: 1px solid red;
    cursor: pointer;
    height: 47px;
    position: absolute;
    right: -59px;
    text-align: right;
    top: 18px;
    width: 53px;
}
#login:hover , .login_hover {
    background: url(../imgs/icons/user.png) !important;
    z-index:9999;

}
.arrow {
    background-image: url("http://satyamsteelvadodara.com/img/green-arrow.png");
    background-repeat: no-repeat;
    height: 15px;
    margin: 64px 0 0 42px;
    position: absolute;
    right: 0;
    width: 21px;
    z-index: 100;
}


.triangle-border {
    position:relative;
    padding:8px;
    margin:1em 0 3em;
    border:2px solid #44C544;
    color:#333;
    background:#fff;
    /* css3 */
    -webkit-border-radius:10px;
    -moz-border-radius:10px;
    border-radius:10px;
}

/* Variant : for left positioned triangle
------------------------------------------ */

.triangle-border.left {
    margin-left:30px;
}

/* Variant : for right positioned triangle
------------------------------------------ */

.triangle-border.right {
    margin-right:30px;
}

/* THE TRIANGLE
------------------------------------------------------------------------------------------------------------------------------- */
.triangle-border:before{
  /*  width: 0; 
    height: 0; 
    border-top: 0 solid transparent;
    border-bottom: 0 solid transparent;

    border-left: 60px solid white;*/
    background-image:url(http://satyamsteelvadodara.com/img/green-arrow.png);




}
.triangle-border1:before {
    content:"";
    position:absolute;
    bottom:-20px; /* value = - border-top-width - border-bottom-width */
    left:40px; /* controls horizontal position */
    border-width:20px 20px 0;
    border-style:solid;
    border-color:#00B100 transparent transparent #00B100 ;
    /* reduce the damage in FF3.0 */
    display:block; 
    width:0;
}

/* creates the smaller  triangle */
.triangle-border:after {
   /* content:"";
    position:absolute;
    bottom:-13px; /* value = - border-top-width - border-bottom-width */
    /*left:47px; /* value = (:before left) + (:before border-left) - (:after border-left) */
    border-width:13px 13px 0;
    border-style:solid;
     border-color:#00B100 transparent transparent #00B100 ;
    /* reduce the damage in FF3.0 */
    display:block; 
    width:0;
}

/* Variant : top
------------------------------------------ */

/* creates the larger triangle */
.triangle-border.top:before {
    top:-20px; /* value = - border-top-width - border-bottom-width */
    bottom:auto;
    left:auto;
    right:10px; /* controls horizontal position */
    border-width:0 15px 20px;
}

/* creates the smaller  triangle */
.triangle-border.top:after {
    top:-15px; /* value = - border-top-width - border-bottom-width */
    bottom:auto;
    left:auto;
    right:10px; /* value = (:before right) + (:before border-right) - (:after border-right) */
    border-width:0 15px 20px;
}

/* Variant : left
------------------------------------------ */

/* creates the larger triangle */
.triangle-border.left:before {
    top:10px; /* controls vertical position */
    bottom:auto;
    left:-30px; /* value = - border-left-width - border-right-width */
    border-width:15px 30px 15px 0;
    border-color:transparent #5a8f00;
}

/* creates the smaller  triangle */
.triangle-border.left:after {
    top:16px; /* value = (:before top) + (:before border-top) - (:after border-top) */
    bottom:auto;
    left:-21px; /* value = - border-left-width - border-right-width */
    border-width:9px 21px 9px 0;
    border-color:transparent #fff;
}

/* Variant : right
------------------------------------------ */

/* creates the larger triangle */
.triangle-border.right:before {
    top:10px; /* controls vertical position */
    bottom:auto;
    left:auto;
    right:-30px; /* value = - border-left-width - border-right-width */
    border-width:15px 0 15px 30px;
    border-color:transparent #5a8f00;
}

/* creates the smaller  triangle */
.triangle-border.right:after {
    top:16px; /* value = (:before top) + (:before border-top) - (:after border-top) */
    bottom:auto;
    left:auto;
    right:-21px; /* value = - border-left-width - border-right-width */
    border-width:9px 0 9px 21px;
    border-color:transparent #fff;
}

#login-content {
position: absolute;
top: 60px;
right:10px;
width: 290px;
color: #848484;
z-index: 9;
padding: 13px;
}

#login-content a { width: 100%; display: block; }
#login-content lable {
    padding-right:10px;
    width: 30%;
    display: inline-block;
}
#login-content div {
    margin-top: 10px;
}
#login-content input[type=text] ,#login-content input[type=password] {
   width: 58%;
   height: 25px;
   border: 1px solid #A6A6A6;
   font-size:12px;
   }
#login-content input[type=text]:focus ,#login-content input[type=password]:focus {  
  border: 1px solid rgba(4, 213, 4, 1);
 }
 #login-content a.forgot {
        float:right;
        font-size:12px;
        cursor: pointer;
        margin-top: 5px;
        color:#848484;
 }  
 #login-content .sign-up{
    position: absolute;
    bottom: 15px;
    font-weight: normal;
    display: none;
 }
#login-content input[type=submit] {
    clear: both;
    margin-top: 10px;
    float: right;
    cursor: pointer;
    font-size: 15px;
    padding:5px 10px;
} 
HTML

    <div id="loginmain">
<div id="login" class="login_hover">

</div>
           <div class="arrow"></div>
<div id="login-content" class="triangle-border top" style="">
    <form onsubmit="loginAjax(); return false;" method="POST" _lpchecked="1">
        <div><lable>Username</lable><input name="username" id="username" type="text"></div>
        <div><lable>Password</lable><input name="password" id="password" type="password"></div>
        <a class="sign-up left clear">Sign Up</a>
        <a class="forgot">Forgot Password?</a>
        <input name="login" type="submit" value="Sign In">
    </form>

</div>
</div>

用户名
密码
注册
忘记密码了?

您的html源代码在哪里请共享html源添加了html和CSS代码,请现在查看我认为您应该制作箭头的图像。没有图像,你就不能喜欢这个你的解决方案。请检查我的答案你的html源代码在哪里请共享html源添加html和CSS代码,请现在检查我认为你应该制作箭头的图像。如果没有图像,你就不能喜欢你的解决方案。请检查我的答案