I have a search box in which there is a button and input for entering text. Please tell me how to embed this button in input, on the right. I know that the input is set to position: relative, and to the absolute button itself. But how to do further I can not understand. I apologize for the long class names.
.middle_content_blog_content_blocks_search_ {
display: block;
height: auto;
}
.middle_content_blog_content_blocks_search {
position: sticky;
top: 50px;
display: flex;
flex-direction: column;
justify-content: space-between;
width: 400px;
height: fit-content;
border: 1px solid #878787;
box-sizing: border-box;
border-radius: 30px;
padding: 25px 25px 25px 25px;
margin: 50px 0 0 0;
}
.middle_content_blog_content_blocks_search_text {
font-family: RobotoCondensed;
font-style: normal;
font-weight: normal;
font-size: 24px;
line-height: 28px;
color: #000000;
}
.middle_content_blog_content_blocks_search_edit {
width: 100%;
height: 50px;
font-size: 16px;
border: 1px solid #878787;
box-sizing: border-box;
border-radius: 30px;
outline: none;
padding: 0 45px 0 20px;
margin: 15px 0 0 0;
}
.middle_content_blog_content_blocks_search_button {
display: flex;
justify-content: center;
align-items: center;
width: 50px;
height: 50px;
border-radius: 20px;
font-family: RobotoCondensed;
font-style: normal;
font-weight: normal;
font-size: 16px;
line-height: 16px;
color: #FFFFFF;
background-color: #B72A20;
cursor: pointer;
user-select: none;
outline: none;
border: none;
}
.search_result_message {
display: inline-flex;
font-family: RobotoCondensed;
font-style: normal;
font-weight: normal;
font-size: 18px;
line-height: 16px;
color: #159815;
margin: 15px 0 0 0;
}
<form class="middle_content_blog_content_blocks_search_">
<label class="middle_content_blog_content_blocks_search_text">
search
</label>
<input type="text" class="middle_content_blog_content_blocks_search_edit" placeholder="search">
<input type="button" class="middle_content_blog_content_blocks_search_button">
<span class="search_result_message"></span>
</form>
Add the following css property to the class .middle_content_blog_content_blocks_search_button,
position: absolute;
right: 6%;
top: 43%;
Snippet as follows,
.middle_content_blog_content_blocks_search_ {
display: block;
height: auto;
}
.middle_content_blog_content_blocks_search {
position: sticky;
top: 50px;
display: flex;
flex-direction: column;
justify-content: space-between;
width: 400px;
height: fit-content;
border: 1px solid #878787;
box-sizing: border-box;
border-radius: 30px;
padding: 25px 25px 25px 25px;
margin: 50px 0 0 0;
}
.middle_content_blog_content_blocks_search_text {
font-family: RobotoCondensed;
font-style: normal;
font-weight: normal;
font-size: 24px;
line-height: 28px;
color: #000000;
}
.middle_content_blog_content_blocks_search_edit {
position: relative;
width: 100%;
height: 50px;
font-size: 16px;
border: 1px solid #878787;
box-sizing: border-box;
border-radius: 30px;
outline: none;
padding: 0 45px 0 20px;
margin: 15px 0 0 0;
}
.middle_content_blog_content_blocks_search_button {
position: absolute;
right: 6%;
top: 43%;
display: flex;
justify-content: center;
align-items: center;
width: 50px;
height: 50px;
border-radius: 20px;
font-family: RobotoCondensed;
font-style: normal;
font-weight: normal;
font-size: 16px;
line-height: 16px;
color: #FFFFFF;
background-color: #B72A20;
cursor: pointer;
user-select: none;
outline: none;
border: none;
}
.search_result_message {
display: inline-flex;
font-family: RobotoCondensed;
font-style: normal;
font-weight: normal;
font-size: 18px;
line-height: 16px;
color: #159815;
margin: 15px 0 0 0;
}
<div class="middle_content_blog_content_blocks_search_">
<div class="middle_content_blog_content_blocks_search">
<div class="middle_content_blog_content_blocks_search_text">
search
</div>
<input type="text" class="middle_content_blog_content_blocks_search_edit" placeholder="search">
<input type="button" class="middle_content_blog_content_blocks_search_button">
<span class="search_result_message"></span>
</div>
</div>
Related
I am trying to move this form but it keeps 'hitting' the h3 tag and the button. I want to move them around without them interfering with one another.
I am talking about the gray panel:
Even when resizing the window, they interact and push one another.
I have tried using margin and padding, but that doesn't seem to work.
.section-3 {
position: relative;
background-color: white;
height: 600px;
top: 959px;
text-align: center;
}
.join-btn {
height: 45px;
font-size: 16px;
text-transform: uppercase;
text-align: center;
border-radius: 2px;
padding: 9px 20px 7px;
color: #373f3d;
border: 2px solid rgba(55, 63, 61, 0.2);
}
.section-3 .heading_section_3 {
font-size: 20px;
position: absolute;
bottom: 70%;
}
.description {
position: absolute;
color: #6e6e6e;
padding-left: 200px;
padding-right: 200px;
}
.join-right-side {
overflow: auto;
background-color: #c9c8c8;
position: absolute;
height: 300px;
padding: 30px;
margin-left: 50%;
display: flex;
align-items: center;
justify-content: center;
width: 50%;
}
.Join-left-side {
overflow: auto;
position: absolute;
height: 300px;
padding: 30px;
background-color: #f5f5f1;
display: flex;
align-items: center;
justify-content: center;
width: 50%;
}
.text-join-left {
color: black;
text-align: center;
padding-left: 200px;
padding-right: 200px;
}
.form {
height: fit-content;
overflow: hidden;
}
input[type="email"] {
border-color: black;
border-width: 2px;
background-color: #c9c8c8;
box-sizing: border-box;
list-style: none;
direction: ltr;
box-sizing: border-box;
padding: 0;
margin: 200px 200px 0px 0px;
display: block;
width: 100%;
appearance: none;
background: none;
border: none;
color: #373f3d;
font-family: GT Pressura Mono, Roboto Mono, monospace;
font-size: 28px;
line-height: 28px;
font-weight: 400;
}
<div class="section-3">
<div class="join-right-side">
<div class="join-btn">Join</div>
<h3 class="text-join-left">Sign up and get 10% off your first purchase.</h3>
<form class="form" action="/">
<input
class="input"
placeholder="Your email address..."
type="email"
name="EMAIL"
/>
</form>
</div>
<div class="join-left-side">
<h2 class="heading_section_3">Swallowtail Tea</h2>
<h3 class="description">
Swallowtail Tea is a Virginia-based tea company sourcing only the highest
quality tea, herbs, and spices from around the world.
</h3>
</div>
</div>
I think it could be linked to the way I'm accessing the div classes, or to the structure of the div's.
You can try:
CSS
.section-3 {
display:flex;
justify-content: space-between;
}
.join-left-side , .join-right-side {
width : 50%;
height: 300px;
}
.section-3 {
position: relative;
background-color: white;
height: 600px;
top: 959px;
text-align: center;
}
.join-btn {
height: 45px;
font-size: 16px;
text-transform: uppercase;
text-align: center;
border-radius: 2px;
padding: 9px 20px 7px;
color: #373f3d;
border: 2px solid rgba(55, 63, 61, .2);
}
.section-3 .heading_section_3 {
font-size: 20px;
}
.description {
color: #6e6e6e;
}
.join-right-side {
background-color: #c9c8c8;
height: 300px;
padding: 30px;
display: flex;
align-items: center;
justify-content: center;
width: 50%;
}
.join-left-side {
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
}
.form{
height: fit-content;
overflow: hidden;
}
input[type=email] {
border-color: black;
border-width: 2px;
background-color: #c9c8c8;
box-sizing: border-box;
list-style: none;
direction: ltr;
box-sizing: border-box;
padding: 0;
margin: 200px 200px 0px 0px;
display: block;
width: 100%;
appearance: none;
background: none;
border: none;
color: #373f3d;
font-family: GT Pressura Mono,Roboto Mono,monospace;
font-size: 28px;
line-height: 28px;
font-weight: 400;
}
HTML
<div class="section-3">
<div class="join-left-side">
<h2 class="heading_section_3">Swallowtail Tea</h2>
<h3 class="description">
Swallowtail Tea is a Virginia-based tea company sourcing only the highest
quality tea, herbs, and spices from around the world.
</h3>
</div>
<div class="join-right-side">
<div class="join-btn">Join</div>
<h3 class="text-join-left">Sign up and get 10% off your first purchase.</h3>
<form class="form" action="/">
<input
class="input"
placeholder="Your email address..."
type="email"
name="EMAIL"
/>
</form>
</div>
</div>
I want to add a border in the button before the icon
what I m using is that
my code is this
.button {
background-color: #4CAF50;
border: none;
color: white;
Width: 660px;
Height:55px;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
background: #333333;
position: absolute;
left: 16.76%;
right: 16.68%;
top: 27.29%;
bottom: 30.89%;
font-family: DIN Pro;
font-style: normal;
font-weight: bold;
font-size: 18px;
line-height: 23px;
text-align: center;
text-transform: uppercase;
color: #F6F6F6;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
Contact<span style="border:solid 1px white"><i class="fa fa-home;"></span></i>
</body>
</html>
but it is not setting up like that. I want to set it up like the same is in the picture
Here is the code you need for the button. To answer your question about the border on the icon, I added a pseudo element (:after) to the button which contains the arrow icon. Then it was just a matter of applying border-left to it.
/* button styles */
.button {
background-color: slategray;
font-family: sans-serif;
border: none;
outline: none;
min-height: 42px;
min-width: 180px;
max-width: 100%;
font-weight: bold;
text-decoration: none;
cursor: pointer;
font-size: 18px;
text-align: center;
text-transform: uppercase;
color: #F6F6F6;
display: inline-flex;
justify-content: center;
align-items: center;
padding: 8px 52px 8px 10px;
position: relative;
}
.button:after {
content: "\f061";
display: flex;
position: absolute;
font-family: "Font Awesome 5 Free", sans-serif;
top: 0;
right: 0;
bottom: 0;
overflow: hidden;
width: 42px;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
border-left: 1px solid #8192a2;
}
.button:hover {
background-color: #8192a2;
}
.button:hover:after {
border-left-color: #95a7b8;
}
/* example styles */
body,
html {
padding: 0;
margin: 0;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
background: coral;
}
* {
box-sizing: border-box;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css">
Contact
I've created This box, but i can't set it's content to stretch accordingly to it's height... once the view is stretched to height - the content is still fixed...and not spread evenly...I've tried to set padding with percentage to the LI - but it's not
working....is there a way to set it only with CSS?
.cont {
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: space-between;
}
.box {
width: 40vw;
height: 50vh;
}
.row_wrapper {
display: flex;
flex-direction: column;
background-color: grey;
border-radius: 5px;
overflow: hidden;
width: 100%;
height: 100%;
}
.flex-row {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
padding: 0px 0px 0px 0px;
margin: 0px;
}
.flex-outer {
width: 100%;
padding: 0px 0px 0px 0px;
margin: 0px;
}
.flex-row li {
width: 50%;
/* padding-right: 10px; */
}
.flex-outer li {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
padding-bottom: 5px;
}
.select {
width: 100%;
border-radius: 5px;
border: 1px solid #dcdcdc;
padding: 5%;
font-size: 0.7vw;
}
.parameters_btn {
border: none;
background-color: #49c8c1;
border-radius: 0.5vw;
font-size: 0.9vw;
padding: 1% 5% 2% 5%;
color: #fff;
outline: none;
width: 50%;
height: 20%;
}
.parameters_btn:hover {
background-color: #40afa9;
outline: none;
}
.parameters_btn:active {
background-color: #2d7c78;
outline: none;
}
.user_box_header {
background-color: #fff;
min-height: 20%;
align-items: center;
justify-content: start;
display: flex;
padding-left: 15px;
border-bottom: 1px solid #e9e9e9;
}
.user_box_header span {
font-size: 0.8vw;
color: #3f4760;
font-family: 'Montserrat Bold', sans-serif;
font-weight: 600;
}
.user_box_header i:before {
padding-right: 0.5vw;
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
color: #49c8c1;
font-size: 18px;
}
.user_notifications i:before {
content: "\f0a2";
}
.user_box_cont {
min-height: 80%;
padding: 5px 10px 5px 10px;
}
.material-switch {
width: 100%;
}
.material-switch>input[type="checkbox"] {
display: none;
}
.material-switch>label {
cursor: pointer;
height: 0px;
position: relative;
width: 40px;
}
.material-switch>input[type="checkbox"]+label::before {
content: "\f222";
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
color: #333333;
text-align: right;
border: 1px solid #dcdcdc;
padding-left: 10px;
padding-right: 10px;
font-size: 1vw;
}
.material-switch>label::before {
background-color: #f6f6f6;
border-radius: 50px;
height: 2.5vh;
margin-top: -12px;
position: absolute;
width: 8vw;
}
.material-switch>label::after {
/*--button---*/
content: "";
font-size: 1vw;
background-color: #fff;
border-radius: 50px;
height: 2.5vh;
left: -4px;
margin-top: -8px;
position: absolute;
top: -4px;
width: 6vw;
border: 1px solid #dcdcdc;
}
.material-switch>input[type="checkbox"]:checked+label::before {
background-color: #f6f6f6;
content: "\f221";
font-family: FontAwesome;
text-align: left;
font-size: 1vw;
}
.material-switch>input[type="checkbox"]:checked+label::after {
background-color: #fff;
left: 30px;
}
.femme {
display: none;
}
.material-switch>input[type="checkbox"]:checked+label>span.homme {
display: none;
}
.material-switch>input[type="checkbox"]:checked+label>span.femme {
display: block;
top: -8px;
}
.homme,
.femme {
font-family: 'Roboto Light', sans-serif;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
color: #5d5d5d;
font-size: 0.7vw;
position: absolute;
top: -10px;
z-index: 999;
}
.material-switch>input[type="checkbox"]:checked+label .homme,
.material-switch>input[type="checkbox"]:checked+label .femme {
left: 43px;
}
.homme::before {
content: "\f222";
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
color: #49c8c1;
margin-right: 5px;
}
.femme::before {
content: "\f221";
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
text-decoration: inherit;
color: #49c8c1;
margin-right: 5px;
}
<div class="cont">
<div class="box">
<div class="row_wrapper">
<div class="user_box_header user_notifications"><i></i>
<p>NOTIFICATIONS</p>
</div>
<div class="user_box_cont">
<ul class="flex-outer">
<li>
<ul class="flex-row">
<li>
<p>Select 3</p>
<select class="params_select">
<option>822-0123-56789</option>
<option>822-0123-56789</option>
<option>822-0123-56789</option>
</select>
</li>
<li>
<p>Select 4</p>
<select class="params_select">
<option>Jean-Luc BÉNAZET</option>
<option>Jean-Luc BÉNAZET</option>
<option>Jean-Luc BÉNAZET</option>
</select>
</li>
</ul>
<li>
</li>
</ul>
<ul class="flex-outer">
<li>
<ul class="flex-row">
<li>
<p>Select 3</p>
<select class="params_select">
<option>822-0123-56789</option>
<option>822-0123-56789</option>
<option>822-0123-56789</option>
</select>
</li>
<li>
<p>Select 4</p>
<select class="params_select">
<option>Jean-Luc BÉNAZET</option>
<option>Jean-Luc BÉNAZET</option>
<option>Jean-Luc BÉNAZET</option>
</select>
</li>
</ul>
<li>
<button class="parameters_btn">
Send
</button>
</li>
</ul>
</div>
</div>
</div>
</div>
To fit the content in the div you must not set the height fixed, use height:auto; you can add max-height and max width, also min-width, min-height.
it's because of your row wrappers height is static ,change its style like code below
.row_wrapper {
display: flex;
flex-direction: column;
background-color: grey;
border-radius: 5px;
overflow: hidden;
width: 100%;
height: auto;
}
It might happen because of your .box height is statically 50vh. If you can change it to auto may give desired output.
Find updated fiddler here. Hope it helps.
I want the link to be on the left of "info" div, but I can't figure out a way to do it, text-align: left; is not working. I think that maybe the CSS is interfering with the text-align property.
#font-face {
font-family: myFirstFont;
src: url(Minecraftia.ttf);
}
a {
font-family: myFirstFont;
text-decoration: none;
font-size: 13px;
}
div#comment {
border-radius: 4px;
margin: 0 auto;
padding: 0 3px;
width: 600px;
}
input[type=submit] {
background-color: white;
font-size: large;
padding: 14px 20px;
margin: 8px 0;
border: 3px solid green;
border-radius: 10px;
cursor: pointer;
font-family: myFirstFont;
text-align: center;
}
input[type=text], input[type=mail], select {
width: 600px;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #CCC;
border-radius: 4px;
box-sizing: border-box;
background-color: #F8F8F8;
font-family: myFirstFont;
}
textarea {
width: 600px;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #CCC;
border-radius: 4px;
box-sizing: border-box;
background-color: #F8F8F8;
font-family: myFirstFont;
resize: none;
}
p
{
font-family: myFirstFont;
font-size: 13px;
margin: 0 auto;
}
div#info {
border-radius: 4px;
margin: 0 auto;
padding: 0 3px;
width: 600px;
border-bottom: 1px solid green;
}
form {
text-align: center;
}
<div id="info"><p>Pringui - 25 août 2016 - Modifier</p></div><div id="comment"> <p>Hello World.</p></div>
You can use floating to move the link before the other text:
a {
float: left;
}
#font-face {
font-family: myFirstFont;
src: url(Minecraftia.ttf);
}
a {
font-family: myFirstFont;
text-decoration: none;
font-size: 13px;
float: left;
}
a::after {
content: ' - ';
white-space: pre;
}
div#comment {
border-radius: 4px;
margin: 0 auto;
padding: 0 3px;
width: 600px;
}
input[type=submit] {
background-color: white;
font-size: large;
padding: 14px 20px;
margin: 8px 0;
border: 3px solid green;
border-radius: 10px;
cursor: pointer;
font-family: myFirstFont;
text-align: center;
}
input[type=text],
input[type=mail],
select {
width: 600px;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #CCC;
border-radius: 4px;
box-sizing: border-box;
background-color: #F8F8F8;
font-family: myFirstFont;
}
textarea {
width: 600px;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #CCC;
border-radius: 4px;
box-sizing: border-box;
background-color: #F8F8F8;
font-family: myFirstFont;
resize: none;
}
p {
font-family: myFirstFont;
font-size: 13px;
margin: 0 auto;
}
div#info {
border-radius: 4px;
margin: 0 auto;
padding: 0 3px;
width: 600px;
border-bottom: 1px solid green;
}
form {
text-align: center;
}
<div id="info">
<p>Pringui - 25 août 2016 Modifier
</p>
</div>
<div id="comment">
<p>Hello World.</p>
</div>
If I understand what you're wanting correctly, then you don't need to edit the CSS. You can just move the anchor to the left of the content inside that div. Or if you want it before the div completely move it outside of the div. If that's not an option you can float the div right and then float the anchor left. But this is a pretty sloppy solution. It'd be better to simply rearrange the HTML.
#font-face {
font-family: myFirstFont;
src: url(Minecraftia.ttf);
}
a {
font-family: myFirstFont;
text-decoration: none;
font-size: 13px;
}
div#comment {
border-radius: 4px;
margin: 0 auto;
padding: 0 3px;
width: 600px;
}
input[type=submit] {
background-color: white;
font-size: large;
padding: 14px 20px;
margin: 8px 0;
border: 3px solid green;
border-radius: 10px;
cursor: pointer;
font-family: myFirstFont;
text-align: center;
}
input[type=text], input[type=mail], select {
width: 600px;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #CCC;
border-radius: 4px;
box-sizing: border-box;
background-color: #F8F8F8;
font-family: myFirstFont;
}
textarea {
width: 600px;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #CCC;
border-radius: 4px;
box-sizing: border-box;
background-color: #F8F8F8;
font-family: myFirstFont;
resize: none;
}
p
{
font-family: myFirstFont;
font-size: 13px;
margin: 0 auto;
}
div#info {
border-radius: 4px;
margin: 0 auto;
padding: 0 3px;
width: 600px;
border-bottom: 1px solid green;
float: right;
}
#info a {
float: left;
margin-right: 5px;
}
form {
text-align: center;
}
<div id="info"><p>Pringui - 25 août 2016 - Modifier</p></div><div id="comment"> <p>Hello World.</p></div>
Observe the following banner I have:
I want the "My Website" and "Your Go To Stop!" text to align both vertically and horizontally but I'm having difficulty getting that to happen.
JS Fiddle: http://jsfiddle.net/z63234p1/
masthead {
top: 32px;
padding-right: 0px;
background: #000;
padding-left: 0;
max-height: 100px;
border-bottom: none;
position: fixed;
z-index: 3;
width: 100%;
min-height: 73px;
color: #000;
display: block;
box-sizing: inherit;
}
.sidebar-toggle {
float: left;
border: 3px solid grey;
border-right: none;
height: 82px;
margin-right: 0;
width: 5%;
overflow: hidden;
padding: 0;
color: #000;
text-align: center;
}
button {
border-radius: 0;
transition: all 125ms ease-out;
cursor: pointer;
-webkit-appearance: button;
font-size: 100%;
margin: 0;
max-width: 100%;
vertical-align: baseline;
line-height: 1.5;
display: inline-block;
align-items: flex-start;
}
.screen-reader-text {
clip: rect(1px, 1px, 1px, 1px);
position: absolute !important;
height: 1px;
width: 1px;
overflow: hidden;
}
.sidebar-toggle:before {
content: "\f419";
height: 24px;
width: 16px;
color: inherit;
font-size: 16px;
line-height: 24px;
speak: none;
text-decoration: inherit;
vertical-align: top;
font-style: normal;
font-weight: normal
display: inline-block;
font-family: Genericons;
-webkit-font-smoothing: antialiased;
}
.site-branding {
width: 95%;
display: inline-flex;
margin-top: 0;
margin-bottom: 0;
float: left;
max-width: 100%;
}
#sitelogo {
display: inline-flex;
vertical-align: middle;
text-align: center;
}
.site-title {
border: 3px solid grey;
font-family: Impact, Charcoal, sans-serif;
font-weight: normal;
margin: 0 auto;
text-align: center;
line-height: normal;
min-width: 150px;
padding: 3px 8px;
font-size: 6vh;
height: 100%;
color: white;
float: left;
max-width: 100%;
}
h1 {
clear: both;
}
.site-description {
background: #fff500;
color: black;
display: block;
font-family: Impact, Charcoal, sans-serif;
margin: auto auto;
text-align: center;
height: 100%;
border-left: none;
border-top: 3px solid grey;
border-bottom: 3px solid grey;
border-right: 3px solid grey;
display: block;
padding: 0 16px;
font-size: 3vh;
line-height: 2.3;
float: left;
clear: none;
}
<header id="masthead" class="site-header" role="banner">
<button class="sidebar-toggle" aria-expanded="false" ><span class="screen-reader-text"><?php _e( 'Toggle Sidebar', 'boardwalk' ); ?></span></button>
<div class="site-branding">
<div id="sitelogo" class="clear">
<h1 class="site-title">My Website</h1>
<h2 class="site-description">Your Go To Stop</h2>
</div>
</div>
</header>
I'm aware that the image above doesn't look at all like the output of JS Fiddle and I know that what I'm getting on my test site is a fluke rather than the actual output.
Can someone help me get my CSS worked out so that all of the text is vertically aligned within their cells and horizontally aligned accross the logo?
Thank you in advance.
Use this Css:
<style type="text/css">
#masthead {
top: 32px;
padding-right: 0px;
background: #000;
padding-left: 0;
max-height: 100px;
border-bottom: none;
position: fixed;
z-index: 3;
width: 100%;
min-height: 73px;
color: #000;
display: block;
box-sizing: inherit;
}
.sidebar-toggle {
float: left;
border: 3px solid grey;
border-right: none;
height: 73px;
margin-right: 0;
width: 5%;
overflow: hidden;
padding: 0;
color: #000;
text-align: center;
}
button {
border-radius: 0;
transition: all 125ms ease-out;
cursor: pointer;
-webkit-appearance: button;
font-size: 100%;
margin: 0;
max-width: 100%;
vertical-align: baseline;
line-height: 1.5;
display: inline-block;
align-items: flex-start;
}
.screen-reader-text {
clip: rect(1px, 1px, 1px, 1px);
position: absolute !important;
height: 1px;
width: 1px;
overflow: hidden;
}
.sidebar-toggle:before {
content: "\f419";
height: 24px;
width: 16px;
color: inherit;
font-size: 16px;
line-height: 24px;
speak: none;
text-decoration: inherit;
vertical-align: top;
font-style: normal;
font-weight: normal
display: inline-block;
font-family: Genericons;
-webkit-font-smoothing: antialiased;
}
.site-branding {
width: 95%;
display: inline-flex;
margin-top: 0;
margin-bottom: 0;
float: left;
max-width: 100%;
}
#sitelogo {
display: inline-flex;
vertical-align: middle;
text-align: center;
}
.site-title {
border: 3px solid grey;
font-family: Impact, Charcoal, sans-serif;
font-weight: normal;
margin: 0 auto;
text-align: center;
line-height: normal;
min-width: 150px;
padding: 4px 8px;
font-size: 6vh;
height: 100%;
color: white;
float: left;
max-width: 100%;
}
h1 {
clear: both;
}
.site-description {
background: #fff500;
color: black;
font-family: Impact, Charcoal, sans-serif;
margin: auto auto;
text-align: center;
height: 100%;
border-left: none;
border-top: 3px solid grey;
border-bottom: 3px solid grey;
border-right: 3px solid grey;
display: block;
padding: 6px 16px;
font-size: 3vh;
line-height: 2.3;
float: left;
clear: none;
}
</style>
New css for #sitelogo:
display: inline-flex;
align-items: stretch;
New css for .site-title:
border: 3px solid grey;
font-family: Impact, Charcoal, sans-serif;
font-weight: normal;
min-width: 150px;
padding: 3px 8px;
font-size: 6vh;
color: white;
display: flex;
align-items: center;
justify-content: center;
New css for .site-description:
background: #fff500;
color: black;
font-family: Impact, Charcoal, sans-serif;
border-left: none;
border-top: 3px solid grey;
border-bottom: 3px solid grey;
border-right: 3px solid grey;
padding: 0 16px;
font-size: 3vh;
display: flex;
align-items: center;
justify-content: center;
Besides that I strongly suggest to not use vh for font-size.
I messed around with your line height of site-title as well as line height and height of site-description. Here's my result:
masthead {
top: 32px;
padding-right: 0px;
background: #000;
padding-left: 0;
max-height: 100px;
border-bottom: none;
position: fixed;
z-index: 3;
width: 100%;
min-height: 73px;
color: #000;
display: block;
box-sizing: inherit;
}
.sidebar-toggle {
float: left;
border: 3px solid grey;
border-right: none;
height: 82px;
margin-right: 0;
width: 5%;
overflow: hidden;
padding: 0;
color: #000;
text-align: center;
}
button {
border-radius: 0;
transition: all 125ms ease-out;
cursor: pointer;
-webkit-appearance: button;
font-size: 100%;
margin: 0;
max-width: 100%;
vertical-align: baseline;
line-height: 1.5;
display: inline-block;
align-items: flex-start;
}
.screen-reader-text {
clip: rect(1px, 1px, 1px, 1px);
position: absolute !important;
height: 1px;
width: 1px;
overflow: hidden;
}
.site-branding {
width: 95%;
display: inline-flex;
margin-top: 0;
margin-bottom: 0;
float: left;
max-width: 100%;
}
#sitelogo {
display: inline-flex;
vertical-align: middle;
text-align: center;
}
.site-title {
border: 3px solid grey;
font-family: Impact, Charcoal, sans-serif;
font-weight: normal;
margin: 0 auto;
text-align: center;
line-height: 58px;
min-width: 150px;
padding: 3px 8px;
font-size: 6vh;
height: 100%;
color: white;
float: left;
max-width: 100%;
}
h1 {
clear: both;
}
.site-description {
background: #fff500;
color: black;
display: block;
font-family: Impact, Charcoal, sans-serif;
margin: auto auto;
text-align: center;
height: 108%;
border-left: none;
border-top: 3px solid grey;
border-bottom: 3px solid grey;
border-right: 3px solid grey;
display: block;
padding: 0 16px;
font-size: 3vh;
line-height: 3.7;
float: left;
clear: none;
}
.sidebar-toggle:before {
content: "\f419";
height: 24px;
width: 16px;
color: inherit;
font-size: 16px;
line-height: 24px;
speak: none;
text-decoration: inherit;
vertical-align: top;
font-style: normal;
font-weight: normal display: inline-block;
font-family: Genericons;
-webkit-font-smoothing: antialiased;
}
Here's a diff compare to see the differences: http://www.mergely.com/vGQedH1p/ Is this what you were looking for?