So I figured out how to do it, but it only works when the page first loads and not responsively. Here's the javascript I used.
if ( $(".alert-box").height() >= 90 ) {
$('.img').css('padding', '30px 20px 0 20px');
}
else {
$('.img').css('padding', '20px 20px 0 20px');
}
Is there any way to make this work while the page is stretched or shrunk?
Ok I'm having an issue where I have an icon on an alert and when it's 1 line of text the icon needs to be center aligned with that text. That part is no problem, now when the page is responsively brought down in size and the line of text breaks we need the icon now to be center aligned with the 2 lines and not just the first line. I was thinking about using the @media code to just set the different padding when a certain pixel is hit, but the alert text is dynamically pulled and it's always changing so the breaks could happen at different widths. Does anyone know of a way to achieve this? I can't figure it out with css, and I'm not really a javascript coder so I'm stumped right now. I feel like this should be possible.
Thank you everyone for your help and time!
Here a quick html page with 3 images explaining what I'm looking to do. I would of posted them here but I don't have enough rep: Images
Here's the css I'm using
.alert-box {
margin-top: 30px;
border-radius: 5px;
padding: 0;
border-style: solid;
border-width: 1px;
display: block;
font-size: 0.8125rem;
font-weight: normal;
position: relative;
transition: opacity 300ms ease-out;
background-color: #008CBA;
border-color: #0078a0;
color: #FFFFFF;
}
.alert-box .text {
padding-left:20px;
font-size:14px;
display:inline;
}
.alert-box p {
margin-bottom: 0;
padding-right: 30px;
padding-left: 67px;
}
.alert-box .img {
padding: 20px 20px 0 20px;
float:left;
position: absolute;
}