Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS position icon to top right of table

Tags:

html

css

I am relatively new to CSS. I have a table on my page which has a width of 70%. I need to position a small icon just above the right side of the table so that the icon is aligned with the right margin of the table below it. How can I achieve this?

So generically this question would be how to position elements relative to the position of other elements on a page using CSS?

Thanks, Calvin

like image 465
Richard N Avatar asked May 29 '12 07:05

Richard N


2 Answers

Hi now you can do this easily throw Position Give to Parent Position Relative and child to give position Absolute and do top right according to your layout

Live demo

http://jsfiddle.net/srgJh/

like image 124
Rohit Azad Malik Avatar answered Sep 30 '22 22:09

Rohit Azad Malik


In CSS you should write:

.myclass {
    position:relative;
}

or

<img style="position:relative;" />

then you can control position by "top", "left", "right", "bottom" statement. Example:

<img src="position: relative; top: 20px;" />
like image 41
Raknel Avatar answered Sep 30 '22 23:09

Raknel