Reputation:
sample photo is like this :
my code as of now is this:
.topnav{
background-color: #0624c5;
overflow: hidden;
padding: 30px;
}
.topnav a{
color: #ffffff;
text-decoration: none;
color: #ffffff;
padding: 15px 16px;
font-size: 15px;
font-family: Raleway Medium;
border-right: 1px solid #0120b8;
}
.topnav a:hover {
color: #ff0004;
text-decoration: underline;
}
.topnav .icon {
display: none;
}
<body>
<div>
<div class="topnav" id="myTopnav">
<a href="#" style="color: #ff0004;">Home</a>
<a href="#">About Us</a>
<a href="#"><span>Companionship & Personal Care Services</span></a>
<a href="#">Alzheimer’s & Parkinson’s Services</a>
<a href="#">Our Caregivers</a>
</div>
</div>
</body>
I hope someone can answer me . It will be a huge help in my activity.. thanks in advance
Upvotes: 1
Views: 442
Reputation: 2516
display: table
and display: table-cell
properties is the solution for your issue. You can make change to these 2 css selector to achieve your desired result.
.topnav{
background-color: #0624c5;
overflow: hidden;
padding: 30px;
display: table;
}
.topnav a{
color: #ffffff;
text-decoration: none;
color: #ffffff;
padding: 15px 16px;
font-size: 15px;
font-family: Raleway Medium;
border-right: 1px solid #0120b8;
display: table-cell;
text-align: center;
vertical-align: middle;
}
Upvotes: 0
Reputation: 9642
For this just use display: inline-block
with max-width
. Check updated snippet below
.topnav{
background-color: #0624c5;
overflow: hidden;
padding: 30px;
}
.topnav a {
color: #ffffff;
text-decoration: none;
color: #ffffff;
padding: 15px 10px;
font-size: 15px;
font-family: Raleway Medium;
border-right: 1px solid #0120b8;
text-align: center;
max-width: 150px;
display: inline-block;
vertical-align: middle;
}
.topnav a:hover {
color: #ff0004;
text-decoration: underline;
}
.topnav .icon {
display: none;
}
<div>
<div class="topnav" id="myTopnav">
<a href="#" style="color: #ff0004;">Home</a>
<a href="#">About Us</a>
<a href="#"><span>Companionship & Personal Care Services</span></a>
<a href="#">Alzheimer’s & Parkinson’s Services</a>
<a href="#">Our Caregivers</a>
</div>
</div>
Upvotes: 2