简体   繁体   English

如何使用css将图片附加到表格右上角?

[英]How do i attach picture to table top-right corner with css?

I only have access to the css code so i can't edit the html.我只能访问 css 代码,所以我无法编辑 html。 here's the page: http://myanimelist.net/animelist/linodiogo and the css code can be found here: http://pastebin.com/Kyz3dkmB .这是页面: http ://myanimelist.net/animelist/linodiogo,css 代码可以在这里找到: http : //pastebin.com/Kyz3dkmB What i wanted to do was attach a transparent picture to the table right top corner so it would look better.我想要做的是在桌子右上角附加一张透明图片,这样看起来会更好。

If you have any other recommendation I'm here to listen.如果您有任何其他建议,我会在这里聆听。

You can use the following via CSS, however you would probably need access to the HTML to be able to incorporate this without affecting the layout of the rest of the table.您可以通过 CSS 使用以下内容,但是您可能需要访问 HTML 才能将其合并,而不会影响表格其余部分的布局。

class/id {
    content:url(http://example.com)
}

I'm not entirely sure from the question/site what your aim is, but if you don't have access to the HTML it sounds as though an absolutely positioned pseudo-element might be the way to go here (even if you do have access to the HTML, it's still a good way to avoid clogged markup).我不完全确定问题/站点的目标是什么,但是如果您无法访问 HTML,那么听起来好像绝对定位的伪元素可能是通往这里的方式(即使您确实有访问 HTML,它仍然是避免阻塞标记的好方法)。 The absolute positioning may avoid disruption to the table element.绝对定位可以避免破坏表格元素。

Add position: relative to the table (or whatever you want the parent to be), and use the following to position a transparent element in the top-right:添加位置:相对于表格(或任何你想要的父元素),并使用以下内容在右上角放置一个透明元素:

parent:before {
    content: '';
    width: ...
    height: ...
    background: transparent;
    position: absolute;
    top: 0;
    right: 0;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM