Let me show you a visual representation of what I'm trying to achieve for better understanding. There's an outer div that occupies 33% of the page and inside it, there's an inner div with a width of 50% in relation to the outer div. The outer div is styled with "text-align: center;" so that there is a 25% space on each side of the inner div. My goal is to align the inner div from the top of the page so that it has the same distance from the top as it does from the sides. Many suggestions I found online recommend using jquery for this, but I'd prefer a CSS-only solution if possible. How can I accomplish this?
I apologize if this seems like a basic question. I am relatively new to frontend development and haven't come across a way to set CSS attributes equal to other attribute values.
Any assistance would be greatly appreciated!
The CSS:
.side{
background-color: #ECEFF1;
height: 100%;
width: 33%;
text-align: center;
}
.profpic{
width: 50%;
border-radius: 50%;
position: relative;
}
The Html:
<div class="side mdl-shadow--4dp" >
<image class="profpic mdl-shadow--4dp" src="/profpic.jpg"></image>
</div>
<div class="content">
</div>