Skip to content

Commit 9cd6f6d

Browse files
committed
chore: apply recommendations
1 parent 0ba6d00 commit 9cd6f6d

File tree

1 file changed

+47
-45
lines changed

1 file changed

+47
-45
lines changed

knowledge-base/tooltip-position-rotated-div.md

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,58 @@ ticketid: 1657431
2525

2626
## Description
2727

28-
When rotating div elements that have an associated [Tooltip]({%slug tooltip-overview%}) to display additional information, the Tooltip might not align correctly with the target element. The goal is to adjust the Tooltip's position so it aligns appropriately with the center of the rotated div, and optionally, remove the Tooltip's callout pointer for a cleaner appearance.
28+
When rotating `<div>` elements that have an associated [Tooltip]({%slug tooltip-overview%}) to display additional information, the Tooltip might not align correctly with the target element. The goal is to adjust the Tooltip's position so it aligns appropriately with the center of the rotated `<div>`, and optionally, remove the Tooltip's callout pointer for a cleaner appearance.
2929

3030
This KB article also answers the following questions:
31-
- How to correctly position a Tooltip on a rotated div in Blazor?
31+
- How to correctly position a Tooltip on a rotated `<div>` in Blazor?
3232
- How can I hide the callout pointer of a Tooltip in Blazor?
3333
- Is there a way to dynamically adjust Tooltip positioning based on element rotation in Blazor?
3434

3535
## Solution
3636

37-
To address the issue of Tooltip misalignment on rotated div elements, consider the following two approaches:
37+
To address the issue of Tooltip misalignment on rotated `<div>` elements, consider the following two approaches:
38+
39+
### Use an Inner Tooltip Target
40+
41+
Embed a tooltip target within the rotated element that won't be affected by the rotation. This method ensures the Tooltip aligns correctly without additional adjustments.
42+
43+
````RAZOR
44+
<TelerikTooltip TargetSelector=".tooltip-target .inner-target" Class="dynamic-tooltip-styles" />
45+
46+
<div style="padding: 5em;">
47+
Hover this rectangle ...
48+
49+
<span class="tooltip-target" style="transform: rotate(-20deg);">
50+
<span title="More info..." class="inner-target">
51+
<TelerikSvgIcon Icon="@SvgIcon.InfoCircle" Size="@ThemeConstants.SvgIcon.Size.ExtraLarge" />
52+
</span>
53+
</span>
54+
55+
... or this one ...
56+
57+
<span class="tooltip-target" style="transform: rotate(45deg);">
58+
<span title="More info..." class="inner-target">
59+
<TelerikSvgIcon Icon="@SvgIcon.InfoCircle" Size="@ThemeConstants.SvgIcon.Size.ExtraLarge"/>
60+
</span>
61+
</span>
62+
</div>
63+
64+
<style>
65+
.tooltip-target {
66+
display: inline-block;
67+
width: 120px;
68+
height: 25px;
69+
background: yellow;
70+
position: relative;
71+
}
72+
73+
.tooltip-target .inner-target {
74+
position: absolute;
75+
right: .4em;
76+
bottom: 0;
77+
}
78+
</style>
79+
````
3880

3981
### Adjust Tooltip Margin Dynamically
4082

@@ -89,48 +131,8 @@ Calculate the necessary offset for the Tooltip and apply it as a margin style. A
89131
}
90132
````
91133

92-
### Use an Inner Tooltip Target
93-
94-
Embed a tooltip target within the rotated element that won't be affected by the rotation. This method ensures the Tooltip aligns correctly without additional adjustments.
95-
96-
````RAZOR
97-
<TelerikTooltip TargetSelector=".tooltip-target .inner-target" Class="dynamic-tooltip-styles" />
98-
99-
<div style="padding: 5em;">
100-
Hover this rectangle ...
101-
102-
<span class="tooltip-target" style="transform: rotate(-20deg);">
103-
<span title="Foo Tooltip" class="inner-target">
104-
<TelerikSvgIcon Icon="@SvgIcon.QuestionCircle" />
105-
</span>
106-
</span>
107-
108-
... or this one ...
109-
110-
<span class="tooltip-target" style="transform: rotate(45deg);">
111-
<span title="Bar Tooltip" class="inner-target">
112-
<TelerikSvgIcon Icon="@SvgIcon.QuestionCircle" />
113-
</span>
114-
</span>
115-
</div>
116-
117-
<style>
118-
.tooltip-target {
119-
display: inline-block;
120-
width: 120px;
121-
height: 20px;
122-
background: yellow;
123-
position: relative;
124-
}
125-
126-
.tooltip-target .inner-target {
127-
position: absolute;
128-
right: .4em;
129-
bottom: 0;
130-
}
131-
</style>
132-
````
133-
134134
## See Also
135135

136136
- [Telerik Blazor Tooltip - Overview]({%slug tooltip-overview%})
137+
- [Hide the Tooltip Callout or Change Its Position]({%slug tooltip-kb-callout-position%})
138+
- [Custom ToolTip Styles and Colors]({%slug tooltip-kb-custom-styles%})

0 commit comments

Comments
 (0)