我正在尝试使用按钮将悬停div class="opa"
居中,而无需考虑div class="hello"
的高度或宽度,因为模板的大小不同。
我正在尝试left:50% , top 50%, position:absolute;
,但我无法实现按钮的中心。
这是我的代码:
.cosa {
display: none;
position: absolute;
}
.hello:hover .cosa {
display: block;
}
.canceled {
background-color: #3F3736;
padding: 10px 20px;
font-size: 15px!important;
color: #fff;
margin-left: 280px!important;
width: 210px;
margin-top: 25px!important;
font-weight: 70!important;
}
<div class="hello">
<div class="opa">
<span id="cancel" class="pull-right canceled cprev previews cosa" ng-click="editing(); addDataSign();"><button type="button">CHANGE TEMPLATE</button></span></div>
<div class="tdescrip ng-pristine ng-untouched ng-valid ng-binding" ng-model="opened.HTML" editor="" data-ng-bind-html="opened.template"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Template signature</title> <table cellpadding="0" cellspacing="0" border="0" style="font-size:11px; font-family: Arial; line-height: 17px;" width="100%"> <tbody><tr> <td valign="top" style="background-color:#f6f7f8; padding: 10px; border-right-width:2px; border-right-style: solid; border-right-color:#ff7f00 " width="50%"> <span style="font-size:13px; color:#29363f; font-weight: bold ">XXXXX</span><br><br> XXXXXXXXXX<br> mobile: XXXXXXXXXXX<br> <span style="color:#009ee0"></span> </td> <td valign="top" style="background-color:#d1d7db; padding: 10px; padding-left: 20px" width="50%"> <span style="font-size:13px; color:#29363f ;font-weight: bold"></span><br><br> XXXXXXX<br> <span style="color:#009ee0"></span> </td> </tr> <tr> <td colspan="2"> <p style="font-size:8px; font-family:Verdana; color:#959595; line-height: 10px;"></p> </td> </tr> </tbody></table> </div>
</div>
答案 0 :(得分:2)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* rmchr(char *string, char ch)
{
int counter = 0;
int new_size = 0;
char corrected_string[100];
while (string[counter] != '\n' && string[counter] != '\0' && string[counter] != EOF) {
if (string[counter] != ch) {
corrected_string[new_size] = string[counter];
new_size++;
}
counter++;
}
char *new_string = (char *)malloc((new_size+1) * sizeof(char));
for (int j = 0; j <= new_size; j++) {
new_string[j] = corrected_string[j];
}
return new_string;
}
int main(int argc, const char * argv[]) {
char *s = "The char 'c' will be removed";
char *new = rmchr(s, 'c');
printf("%s", new);
return 0;
}