固定在div侧边的宽度和高度100%不起作用 [英] anchor in side div width and height 100% not working

查看:78
本文介绍了固定在div侧边的宽度和高度100%不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

div的宽度为250px,高度为35px,其内部有一个高度和宽度为100%的锚点,但在运行时,锚点的宽度未呈现为250px,高度未呈现为35px,其拉伸取决于数据. >

div has width of 250px and height of 35px ,inside it there is an anchor with width and height 100% but at runtime anchor width not rendering as 250px and height is not rendering as 35px its stretching depending on data.

div.css
{
height:35px;
width:500px;
}
a.css
{
height:100%;
width:100%;
display:table - cell;
text-align:center;
vertical-align:middle;
}



锚宽度和高度分别为25px和10px的输出,具体取决于其范围内的数据.

如果我将锚点显示更改为块,宽度变为250px,高度35px如我所愿,但跨在锚点垂直对齐的中间,则无法正常工作到顶部位置.有谁可以帮助我



output for anchor width and height 25px and 10px depending on data inside its span.

if i change anchor display to block,width becoming 250px and height 35px as i wanted, but span inside anchor vertical-align middle not working its going to top position.can any one help me here

推荐答案

很高兴您解决了您的问题,但是请您写下您在解决方案中所做的事情并将其标记为答案吗?

来自OP:
I am glad you resolved your issue, but can you please write down what you did in a solution an mark it as answer?

From OP:
报价:

我解决了,实际上锚标记在更改为阻止其正常工作时已显示为表格单元格

I resolved, actually anchor tag has display as table-cell when changed it to block its working fine



亲切的问候
肯尼斯(Kenneth):-)



Kind regards
Kenneth :-)


我更改了//行,然后工作了

i changed // lines then its working

div.css
{
//height:35px;
line-height:35px;
width:500px;
}







a.css
{
height:100%;
width:100%;
//display:table - cell;
display:block;
text-align:center;
vertical-align:middle;
}


这篇关于固定在div侧边的宽度和高度100%不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆