Inspired by the answer https://stackoverflow.com/questions/36265026/angular-2-innerhtml-styling
, it worked If I change all of my classes to the format :host >>> selector
i.e. (the commented part was what I was using earlier. I changed from class (eg close-cross-link
to selector by giving an id to a
(a#close-button
)
:host >>> a#close-button /*.close-cross-link*/ {
border: 1px solid black;
width: 100px;
height: 100px;
opacity: 0.3;
background-color:white;
position:relative;
top:-15px;
left:-15px;
/*border-radius:50%; /*makes a circle*/
}
:host >>> a#close-button:hover /*.close-cross-link:hover */{
opacity: 1;
}
:host >>> a#close-button:before, :host >>> a#close-button:after /*.close-cross-link:before, .close-cross-link:after*/ {
display:inline-block;/*need display+relative+left or absolute+left*/
position:relative;
left: 13px;
border: 1px solid black;
top:0px;
right:0px;
content: '';
height: 31px;
width: 2px;
background-color: #333;
border-radius:50%; /*makes cross sharper*/
}
:host >>> a#close-button:before /*.close-cross-link:before */{
transform: rotate(45deg);
}
:host >>> a#close-button:after /*.close-cross-link:after*/ {
transform: rotate(-45deg);
}