CSS Overflow whitespace text - css

Basically I am trying out CSS trying to create a chat box for some reason when I float:right the chat message it goes out of the chat box but I when I float:left it works fine as it should be here is the JS Fiddle which shows the problem!
https://jsfiddle.net/g8ax21aa/
a {
text-decoration: none;
}
fieldset {
border: 0;
margin: 0;
padding: 0;
}
h4,
h5 {
line-height: 3.0em;
margin: 0;
}
hr {
background: #e9e9e9;
border: 0;
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 1px;
margin: 0;
min-height: 1px;
}
img {
border: 0;
display: block;
height: auto;
max-width: 100%;
}
input {
border: 0;
color: inherit;
font-family: inherit;
font-size: 100%;
line-height: normal;
margin: 0;
}
.clearfix {
*zoom: 1;
}
/* For IE 6/7 */
.clearfix:before,
.clearfix:after {
content: "";
display: table;
}
.clearfix:after {
clear: both;
}
/* ---------- LIVE-CHAT ---------- */
#live-chat {
font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;
bottom: 0;
font-size: 12px;
right: 24px;
position: fixed;
width: 300px;
}
#live-chat header {
background: #293239;
border-radius: 5px 5px 0 0;
color: #fff;
cursor: pointer;
padding: 16px 24px;
}
#live-chat h4:before {
background: #1a8a34;
border-radius: 50%;
content: "";
display: inline-block;
height: 8px;
margin: 0 8px 0 0;
width: 8px;
}
#live-chat h4 {
font-size: 12px;
}
#live-chat h5 {
font-size: 10px;
}
#live-chat form {
padding: 24px;
}
#live-chat input[type="text"] {
border: 1px solid #ccc;
border-radius: 3px;
padding: 8px;
outline: none;
width: 234px;
}
.chat-message-counter {
background: #e62727;
border: 1px solid #fff;
border-radius: 50%;
display: none;
font-size: 12px;
font-weight: bold;
height: 28px;
left: 0;
line-height: 28px;
margin: -15px 0 0 -15px;
position: absolute;
text-align: center;
top: 0;
width: 28px;
}
.chat-close {
background: #1b2126;
border-radius: 50%;
color: #fff;
display: block;
float: right;
font-size: 10px;
height: 16px;
line-height: 16px;
margin: 2px 0 0 0;
text-align: center;
width: 16px;
}
.chat {
background: #fff;
}
.chat-history {
height: 252px;
padding: 8px 24px;
overflow-y: scroll;
}
.chat-message {
margin: 16px 0;
}
.chat-message img {
border-radius: 50%;
float: left;
}
.chat-time {
float: right;
font-size: 10px;
}
.user {
color: #fff;
background-color: #4080ff;
clear: right;
float: right;
}
.server {
background-color: #f1f0f0;
color: #4b4f56;
margin-left: 15px;
clear: left;
float: left;
}
.msg {
overflow-wrap: inherit;
text-shadow: none;
overflow: hidden;
border-radius: 5px;
padding: 5px 8px 6px;
border: 1px solid #d2d6de;
}
<div id="live-chat">
<header class="clearfix">
x
<h4>LOG</h4>
</header>
<div class="chat">
<div class="chat-history">
<div class="chat-message clearfix">
<div class="chat-message-content clearfix">
<span class="chat-time">13:35</span>
<span class="msg user">aslkdsakdhsalkdsakldhsalkdhklashdklsahdklhsakldhklashkldaskdlkklsaskldklsad!.</span>
</div>
</div>
<hr>
<div class="chat-message clearfix">
<img src="./imgs/u1.png" alt="" width="32" height="32">
<div class="chat-message-content clearfix">
<span class="chat-time">13:37</span>
<h5>UROA</h5>
<span class="msg server">HIasklhdlksahdklsahdklashdlkhadlkahkdhlsahdhkalkdhsahldkahlkdlkaslkdhkaskhldkla!</span>
</div>
</div>
<hr>
</div>
<form id="chat_form">
<fieldset>
<input type="text" placeholder="Type your messageā€¦" autofocus>
<input type="hidden">
</fieldset>
</form>
</div>
</div>
Thank you for your time and help.

.msg {
word-break: break-all;
}
seems to be the way to go. MDN.
PS. It turns out that break-word is an unofficial value for word-break property and it should be break-all. From caniuse:
Partial support (CSS3 word-break property) refers to supporting the break-all value, but not the keep-all value. Chrome, Safari and other WebKit/Blink browsers also support the unofficial break-word value which is treated like word-wrap: break-word.
So, you are better off using word-break: break-all;

See my code below. I added word-break: break-word;
and it works fine.
a {
text-decoration: none;
}
fieldset {
border: 0;
margin: 0;
padding: 0;
}
h4,
h5 {
line-height: 3.0em;
margin: 0;
}
hr {
background: #e9e9e9;
border: 0;
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 1px;
margin: 0;
min-height: 1px;
}
img {
border: 0;
display: block;
height: auto;
max-width: 100%;
}
input {
border: 0;
color: inherit;
font-family: inherit;
font-size: 100%;
line-height: normal;
margin: 0;
}
.clearfix {
*zoom: 1;
}
/* For IE 6/7 */
.clearfix:before,
.clearfix:after {
content: "";
display: table;
}
.clearfix:after {
clear: both;
}
/* ---------- LIVE-CHAT ---------- */
#live-chat {
font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;
bottom: 0;
font-size: 12px;
right: 24px;
position: fixed;
width: 300px;
}
#live-chat header {
background: #293239;
border-radius: 5px 5px 0 0;
color: #fff;
cursor: pointer;
padding: 16px 24px;
}
#live-chat h4:before {
background: #1a8a34;
border-radius: 50%;
content: "";
display: inline-block;
height: 8px;
margin: 0 8px 0 0;
width: 8px;
}
#live-chat h4 {
font-size: 12px;
}
#live-chat h5 {
font-size: 10px;
}
#live-chat form {
padding: 24px;
}
#live-chat input[type="text"] {
border: 1px solid #ccc;
border-radius: 3px;
padding: 8px;
outline: none;
width: 234px;
}
.chat-message-counter {
background: #e62727;
border: 1px solid #fff;
border-radius: 50%;
display: none;
font-size: 12px;
font-weight: bold;
height: 28px;
left: 0;
line-height: 28px;
margin: -15px 0 0 -15px;
position: absolute;
text-align: center;
top: 0;
width: 28px;
}
.chat-close {
background: #1b2126;
border-radius: 50%;
color: #fff;
display: block;
float: right;
font-size: 10px;
height: 16px;
line-height: 16px;
margin: 2px 0 0 0;
text-align: center;
width: 16px;
}
.chat {
background: #fff;
}
.chat-history {
height: 252px;
padding: 8px 24px;
overflow-y: scroll;
}
.chat-message {
margin: 16px 0;
word-break: break-word;
}
.chat-message img {
border-radius: 50%;
float: left;
}
.chat-time {
float: right;
font-size: 10px;
}
.user {
color: #fff;
background-color: #4080ff;
clear: right;
float: right;
}
.server {
background-color: #f1f0f0;
color: #4b4f56;
margin-left: 15px;
clear: left;
float: left;
}
.msg {
overflow-wrap: inherit;
text-shadow: none;
overflow: hidden;
border-radius: 5px;
padding: 5px 8px 6px;
border: 1px solid #d2d6de;
}
<div id="live-chat">
<header class="clearfix">
x
<h4>LOG</h4>
</header>
<div class="chat">
<div class="chat-history">
<div class="chat-message clearfix">
<div class="chat-message-content clearfix">
<span class="chat-time">13:35</span>
<span class="msg user">aslkdsakdhsalkdsakldhsalkdhklashdklsahdklhsakldhklashkldaskdlkklsaskldklsad!.</span>
</div>
</div>
<hr>
<div class="chat-message clearfix">
<img src="./imgs/u1.png" alt="" width="32" height="32">
<div class="chat-message-content clearfix">
<span class="chat-time">13:37</span>
<h5>UROA</h5>
<span class="msg server">HIasklhdlksahdklsahdklashdlkhadlkahkdhlsahdhkalkdhsahldkahlkdlkaslkdhkaskhldkla!</span>
</div>
</div>
<hr>
</div>
<form id="chat_form">
<fieldset>
<input type="text" placeholder="Type your messageā€¦" autofocus>
<input type="hidden">
</fieldset>
</form>
</div>
</div>

you must use
.msg {
width:256px; // add this
word-wrap:break-word;// add this
...//your code
}
Demo in jsfiddle

The problem is that in real life there are no words with that size of characters
try this:
width: 100%;
text-overflow: ellipsis;

Related

Change text hover

How change text when I push cursor in button? If I push cursor in button with price, will show text: "Add to basket".
This is Code:
body {
font-family: 'Roboto', sans-serif;
}
.price {
font-size: 1em;
border-radius: 50px;
background-color: #f00;
text-align: center;
color: #fff;
padding: 5px;
width: 10%;
margin: 20px auto;
}
.price:hover {
background-color: #fff;
border: 1px solid #bfbfbf;
color: #f00;
cursor: pointer;
}
.info {
display: none;
}
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"/>
<div class="price">$50</div>
<div class="info">Add to basket</div>
How solve this problem?
You can use a wrapper div to catch the over, I think is more maintainable if you change the html in the future:
body {
font-family: 'Roboto', sans-serif;
}
.price {
font-size: 1em;
border-radius: 50px;
background-color: #f00;
text-align: center;
color: #fff;
padding: 5px;
width: 10%;
margin: 20px auto;
}
.price:hover {
background-color: #fff;
border: 1px solid #bfbfbf;
color: #f00;
cursor: pointer;
}
.info {
display: none;
width: 20%;
margin: 20px auto;
cursor: pointer;
}
.wrapper:hover .info {
display: block;
}
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"/>
<div class="wrapper">
<div class="price">$50</div>
<div class="info">Add to basket</div>
</div>
you can use :active to show text when mouse is clicking down on the price like so:
.price {
font-size: 1em;
border-radius: 50px;
background-color: #f00;
text-align: center;
color: #fff;
padding: 5px;
width: 10%;
margin: 20px auto;
}
.price:hover {
background-color: #fff;
border: 1px solid #bfbfbf;
color: #f00;
cursor: pointer;
}
.info {
display: none;
}
.price:active + .info {
display: block;
}
<div class="price">$50</div>
<div class="info">Add to basket</div>
if you are trying to show the text on :hover like the title of the question says the unser :hover like so:
.price {
font-size: 1em;
border-radius: 50px;
background-color: #f00;
text-align: center;
color: #fff;
padding: 5px;
width: 10%;
margin: 20px auto;
}
.price:hover {
background-color: #fff;
border: 1px solid #bfbfbf;
color: #f00;
cursor: pointer;
}
.info {
display: none;
}
.price:hover + .info {
display: block;
}
<div class="price">$50</div>
<div class="info">Add to basket</div>
Update 3:
.price {
font-size: 1em;
border-radius: 50px;
background-color: #f00;
text-align: center;
color: #fff;
padding: 5px;
width: 10%;
margin: 20px auto;
}
.price:hover {
background-color: #fff;
border: 1px solid #bfbfbf;
color: #f00;
cursor: pointer;
}
.info,
.price:hover .amount {
display: none;
}
.price:hover .info {
display: block;
}
<div class="price">
<div class="amount">$50</div>
<div class="info">Add to basket</div>
</div>

ul below the input element is not occupying the same width of the input element

I have a input text and below this input text I want to have a div with a green color that has some text. But I want that this green area to occupy the same with of the input element, but it is not working. Do you know what is not correct?
.main-search {
width: 100%;
position: relative;
background-color: yellow;
}
.search {
margin: 20px auto;
width: 100%;
font-size: 0.85em;
float: left;
background-color: white;
padding: 50px;
border-radius: 4px;
}
.search_auto_complete {
background-color: green;
text-align: left;
color: gray;
font-size: 1.1em;
border: 1px solid black;
z-index: 10;
position: fixed;
width: inherit;
padding: 0 !important;
}
.search_auto_complete li {
padding: 10px;
background-color: $color-white;
border-bottom: 1px solid $color-gray;
}
.auto_complete_category {
background-color: $color-light-plus !important;
color: $color-gray-plus-plus;
font-weight: bold;
}
.auto_complete_category:hover {
background-color: $color-light-plus !important;
cursor: auto !important;
color: $color-gray-plus-plus !important;
}
.events_auto_complete li:hover {
background-color: $color-primary;
cursor: pointer;
color: $color-white;
}
.search_events_box button {
border-left: none;
color: #fff;
font-weight: 700;
padding: 17px;
}
.input_search_event {
position: relative;
border: 1px solid red;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
outline: 0;
}
input {
padding-left: 40px !important;
}
input {
padding: 15px;
width: 100%;
}
.content {
float: left;
width: 100%;
}
.div {
width: 60%;
margin: 0 auto;
padding: 20px 0;
}
<section class="content main-search">
<div class="div">
<h1>Title</h1>
<div class="search">
<div class="input_search">
<input id="auto" value="category" type="text">
<ul class="search_auto_complete">
<li class="auto_complete_category">Categories</li>
<li>Category 1</li>
</ul>
</div>
</div>
</div>
</section>
Example: https://jsfiddle.net/k9uL4zon/
Add position: relative to your container .input_search and replace position: fixed with position: absolute and width: inherit with width: 100% for your element .search_auto_complete. Demo:
.input_search {
position: relative; /* new */
}
.main-search {
width: 100%;
position: relative;
background-color: yellow;
}
.search {
margin: 20px auto;
width: 100%;
font-size: 0.85em;
float: left;
background-color: white;
padding: 50px;
border-radius: 4px;
}
.search_auto_complete {
background-color: green;
text-align: left;
color: gray;
font-size: 1.1em;
border: 1px solid black;
z-index: 10;
position: absolute;
width: 100%;
padding: 0 !important;
}
.search_auto_complete li {
padding: 10px;
background-color: $color-white;
border-bottom: 1px solid $color-gray;
}
.auto_complete_category {
background-color: $color-light-plus !important;
color: $color-gray-plus-plus;
font-weight: bold;
}
.auto_complete_category:hover {
background-color: $color-light-plus !important;
cursor: auto !important;
color: $color-gray-plus-plus !important;
}
.events_auto_complete li:hover {
background-color: $color-primary;
cursor: pointer;
color: $color-white;
}
.search_events_box button {
border-left: none;
color: #fff;
font-weight: 700;
padding: 17px;
}
.input_search_event {
position: relative;
border: 1px solid red;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
outline: 0;
}
input {
padding-left: 40px !important;
}
input {
padding: 15px;
width: 100%;
}
.content {
float: left;
width: 100%;
}
.div {
width: 60%;
margin: 0 auto;
padding: 20px 0;
}
<section class="content main-search">
<div class="div">
<h1>Title</h1>
<div class="search">
<div class="input_search">
<input id="auto" value="category" type="text">
<ul class="search_auto_complete">
<li class="auto_complete_category">Categories</li>
<li>Category 1</li>
</ul>
</div>
</div>
</div>
</section>

profile icon dropdown tolltip with arrow

This has been really frustrating. I'm trying to add a dropdown tooltip at the bottom of my profile avatar. Unfortunately that does not seem to work properly. The tooltip seems to be partly hidden. How can i keep the specific design of the tooltip and make it display directly at the bottom of the icon with the arrow pointing in the middle of the icon?
body {
background-color: #36a4b0;
}
#shell-header {
display: flex;
height: 46px;
overflow: hidden;
z-index: 3;
opacity: 1;
white-space: nowrap;
}
.logo-wrapper {
padding-left: 56px;
}
#media (max-width: 480px) {
.logo-wrapper {
padding-left: 1rem;
}
}
.title-wrapper {
left: 0;
right: 0;
text-align: right;
flex-grow: 1;
}
.avatar-wrapper {
padding-right: 56px;
position: relative;
}
#media (max-width: 480px) {
.avatar-wrapper {
padding-right: 1rem;
}
}
.logo {
height: 30px;
line-height: 40px;
max-width: 96px;
margin-top: 0.35rem;
}
.log-shellHeaderTitle {
font-size: 20px;
line-height: 36px;
color: #fff;
text-overflow: ellipsis;
text-align: center;
display: block;
white-space: nowrap;
overflow: hidden;
font-weight: inherit;
margin-left: 0px;
margin-top: 0px;
margin-bottom: 0px;
text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}
.log-langButton {
padding-right: 40px;
}
#media only screen and (max-width: 480px) {
.log-langButton {
padding-right: 10px;
}
}
#log-LangButtSwitch {
background: transparent;
cursor: pointer;
display: block;
position: relative;
float: left;
width: 40px;
padding: 2px;
margin-top: 0.25rem;
border: 2px solid #fff;
border-radius: 28px;
}
.log-switchHandle {
display: block;
background: #fff;
height: 20px;
width: 20px;
z-index: 9999;
border-radius: 20px;
}
.log-switchLabels {
position: absolute;
top: 5px;
z-index: -1;
width: 100%;
font-family: Helvetica, sans-serif;
font-weight: bold;
color: #fff;
text-transform: uppercase;
text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}
.log-switchLabels:before {
content: "EN";
position: absolute;
left: 21px;
font-size: 12px;
}
.log-switchLabels:after {
content: "DE";
position: absolute;
right: 26px;
font-size: 12px;
}
.fa-user-o:before {
font-size: 1.375rem;
color: #fff;
}
.avatar {
text-align: center;
margin-top: 0.35rem;
width: 25px;
}
.log-popover {
visibility: visible;
z-index: 460;
display: block;
overflow: visible;
top: 121px;
left: 375.063px;
bottom: 10px;
transition: opacity 0.2s linear;
color: #333333;
min-width: 100px;
box-sizing: border-box;
outline: none;
max-width: 100%;
max-height: 84px;
min-height: 2rem;
overflow: hidden;
background: #ffffff;
border: none;
box-shadow: 0 0.625rem 1.875rem 0 rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.15);
border-radius: 0.25rem;
}
.log-popover a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.log-popover a:hover {
background-color: #f0f0f0;
}
.log-popover a:active,
.log-popover a:focus {
background: #e8eff6;
outline: 1px dotted #000000;
outline-offset: -2px;
}
.log-popover:after,
.log-popover:before {
bottom: 100%;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.log-popover:after {
border-color: rgba(255, 255, 255, 0);
border-bottom-color: #fff;
border-width: 10px;
margin-left: -10px;
}
.log-popover:before {
border-color: rgba(51, 51, 51, 0);
border-bottom-color: #333333;
border-width: 11px;
margin-left: -11px;
}
.log-toolContainer {
position: absolute;
height: 100%;
width: 100%;
}
<div class="log-container">
<div id="shell-header">
<div class="logo-wrapper">
<img src="https://s-media-cache-ak0.pinimg.com/236x/f7/0a/f6/f70af6169bbe3f8346e64a25d54bafea.jpg" class="logo">
</div>
<div class="title-wrapper">
<div class="log-shellHeaderTitle">Dashboard</div>
</div>
<div class="log-langButton">
<div id="log-LangButtSwitch">
<span class="log-switchHandle"></span>
<span class="log-switchLabels"></span>
</div>
</div>
<div class="avatar-wrapper">
<img class="avatar" src="https://www.talentenportaalhellendoorn.nl/thumbnails/man.png">
<div class="log-toolContainer">
<div class="log-popover">
Profile
Log out
</div>
</div>
</div>
</div>
</div>
remove overflow: hidden; from #shell-header so the menu isn't cut off, then use positioning to put the container for the menu in the bottom/left of the parent, and use translateX() to offset it 50% of it's own width + 50% of the avatar width to center it under the icon.
body {
background-color: #36a4b0;
}
#shell-header {
display: flex;
height: 46px;
z-index: 3;
opacity: 1;
white-space: nowrap;
}
.logo-wrapper {
padding-left: 56px;
}
#media (max-width: 480px) {
.logo-wrapper {
padding-left: 1rem;
}
}
.title-wrapper {
left: 0;
right: 0;
text-align: right;
flex-grow: 1;
}
.avatar-wrapper {
padding-right: 56px;
position: relative;
}
#media (max-width: 480px) {
.avatar-wrapper {
padding-right: 1rem;
}
}
.logo {
height: 30px;
line-height: 40px;
max-width: 96px;
margin-top: 0.35rem;
}
.log-shellHeaderTitle {
font-size: 20px;
line-height: 36px;
color: #fff;
text-overflow: ellipsis;
text-align: center;
display: block;
white-space: nowrap;
overflow: hidden;
font-weight: inherit;
margin-left: 0px;
margin-top: 0px;
margin-bottom: 0px;
text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}
.log-langButton {
padding-right: 40px;
}
#media only screen and (max-width: 480px) {
.log-langButton {
padding-right: 10px;
}
}
#log-LangButtSwitch {
background: transparent;
cursor: pointer;
display: block;
position: relative;
float: left;
width: 40px;
padding: 2px;
margin-top: 0.25rem;
border: 2px solid #fff;
border-radius: 28px;
}
.log-switchHandle {
display: block;
background: #fff;
height: 20px;
width: 20px;
z-index: 9999;
border-radius: 20px;
}
.log-switchLabels {
position: absolute;
top: 5px;
z-index: -1;
width: 100%;
font-family: Helvetica, sans-serif;
font-weight: bold;
color: #fff;
text-transform: uppercase;
text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}
.log-switchLabels:before {
content: "EN";
position: absolute;
left: 21px;
font-size: 12px;
}
.log-switchLabels:after {
content: "DE";
position: absolute;
right: 26px;
font-size: 12px;
}
.fa-user-o:before {
font-size: 1.375rem;
color: #fff;
}
.avatar {
text-align: center;
margin-top: 0.35rem;
width: 25px;
}
.log-popover {
visibility: visible;
z-index: 460;
display: block;
overflow: visible;
top: 121px;
left: 375.063px;
bottom: 10px;
transition: opacity 0.2s linear;
color: #333333;
min-width: 100px;
box-sizing: border-box;
outline: none;
max-width: 100%;
max-height: 84px;
min-height: 2rem;
overflow: hidden;
background: #ffffff;
border: none;
box-shadow: 0 0.625rem 1.875rem 0 rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.15);
border-radius: 0.25rem;
}
.log-popover a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.log-popover a:hover {
background-color: #f0f0f0;
}
.log-popover a:active,
.log-popover a:focus {
background: #e8eff6;
outline: 1px dotted #000000;
outline-offset: -2px;
}
.log-popover:after,
.log-popover:before {
bottom: 100%;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.log-popover:after {
border-color: rgba(255, 255, 255, 0);
border-bottom-color: #fff;
border-width: 10px;
margin-left: -10px;
}
.log-popover:before {
border-color: rgba(51, 51, 51, 0);
border-bottom-color: #333333;
border-width: 11px;
margin-left: -11px;
}
.log-toolContainer {
position: absolute;
height: 100%;
width: 100%;
top: 100%;
left: 0;
transform: translateX(calc(-50% + 12.5px));
}
<div class="log-container">
<div id="shell-header">
<div class="logo-wrapper">
<img src="https://s-media-cache-ak0.pinimg.com/236x/f7/0a/f6/f70af6169bbe3f8346e64a25d54bafea.jpg" class="logo">
</div>
<div class="title-wrapper">
<div class="log-shellHeaderTitle">Dashboard</div>
</div>
<div class="log-langButton">
<div id="log-LangButtSwitch">
<span class="log-switchHandle"></span>
<span class="log-switchLabels"></span>
</div>
</div>
<div class="avatar-wrapper">
<img class="avatar" src="https://www.talentenportaalhellendoorn.nl/thumbnails/man.png">
<div class="log-toolContainer">
<div class="log-popover">
Profile
Log out
</div>
</div>
</div>
</div>
</div>
Remove overflow hidden from #shell-header...
body {
background-color: #36a4b0;
}
#shell-header {
display: flex;
height: 46px;
overflow: visible;
z-index: 3;
opacity: 1;
white-space: nowrap;
}
.logo-wrapper {
padding-left: 56px;
}
#media (max-width: 480px) {
.logo-wrapper {
padding-left: 1rem;
}
}
.title-wrapper {
left: 0;
right: 0;
text-align: right;
flex-grow: 1;
}
.avatar-wrapper {
padding-right: 56px;
position: relative;
}
#media (max-width: 480px) {
.avatar-wrapper {
padding-right: 1rem;
}
}
.logo {
height: 30px;
line-height: 40px;
max-width: 96px;
margin-top: 0.35rem;
}
.log-shellHeaderTitle {
font-size: 20px;
line-height: 36px;
color: #fff;
text-overflow: ellipsis;
text-align: center;
display: block;
white-space: nowrap;
overflow: hidden;
font-weight: inherit;
margin-left: 0px;
margin-top: 0px;
margin-bottom: 0px;
text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}
.log-langButton {
padding-right: 40px;
}
#media only screen and (max-width: 480px) {
.log-langButton {
padding-right: 10px;
}
}
#log-LangButtSwitch {
background: transparent;
cursor: pointer;
display: block;
position: relative;
float: left;
width: 40px;
padding: 2px;
margin-top: 0.25rem;
border: 2px solid #fff;
border-radius: 28px;
}
.log-switchHandle {
display: block;
background: #fff;
height: 20px;
width: 20px;
z-index: 9999;
border-radius: 20px;
}
.log-switchLabels {
position: absolute;
top: 5px;
z-index: -1;
width: 100%;
font-family: Helvetica, sans-serif;
font-weight: bold;
color: #fff;
text-transform: uppercase;
text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}
.log-switchLabels:before {
content: "EN";
position: absolute;
left: 21px;
font-size: 12px;
}
.log-switchLabels:after {
content: "DE";
position: absolute;
right: 26px;
font-size: 12px;
}
.fa-user-o:before {
font-size: 1.375rem;
color: #fff;
}
.avatar {
text-align: center;
margin-top: 0.35rem;
width: 25px;
}
.log-popover {
visibility: visible;
z-index: 460;
display: block;
overflow: visible;
top: 121px;
left: 375.063px;
bottom: 10px;
transition: opacity 0.2s linear;
color: #333333;
min-width: 100px;
box-sizing: border-box;
outline: none;
max-width: 100%;
max-height: 84px;
min-height: 2rem;
overflow: hidden;
background: #ffffff;
border: none;
box-shadow: 0 0.625rem 1.875rem 0 rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.15);
border-radius: 0.25rem;
}
.log-popover a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.log-popover a:hover {
background-color: #f0f0f0;
}
.log-popover a:active,
.log-popover a:focus {
background: #e8eff6;
outline: 1px dotted #000000;
outline-offset: -2px;
}
.log-popover:after,
.log-popover:before {
bottom: 100%;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.log-popover:after {
border-color: rgba(255, 255, 255, 0);
border-bottom-color: #fff;
border-width: 10px;
margin-left: -10px;
}
.log-popover:before {
border-color: rgba(51, 51, 51, 0);
border-bottom-color: #333333;
border-width: 11px;
margin-left: -11px;
}
.log-toolContainer {
position: absolute;
height: 100%;
width: 100%;
}
<div class="log-container">
<div id="shell-header">
<div class="logo-wrapper">
<img src="https://s-media-cache-ak0.pinimg.com/236x/f7/0a/f6/f70af6169bbe3f8346e64a25d54bafea.jpg" class="logo">
</div>
<div class="title-wrapper">
<div class="log-shellHeaderTitle">Dashboard</div>
</div>
<div class="log-langButton">
<div id="log-LangButtSwitch">
<span class="log-switchHandle"></span>
<span class="log-switchLabels"></span>
</div>
</div>
<div class="avatar-wrapper">
<img class="avatar" src="https://www.talentenportaalhellendoorn.nl/thumbnails/man.png">
<div class="log-toolContainer">
<div class="log-popover">
Profile
Log out
</div>
</div>
</div>
</div>
</div>

h1 tag positioning on mobile browser

I cant seem to figure out why the h1 tag is showing differently on mobile browsers.
The site is www.jd-financialservices.co.uk When I view the site on my desktop everything is fine. When I view it on my Nexus 4 however, the 10px gap between h1 and the .topbar div has gone. It's the same on Opera, Firefox and Chrome.
Can anyone help please?
Thank you in advance.
I would advise against using position:relative; and negative top on all of your elements.
With some minor changes to your css you will probably find that it fixes itself: here is my updated version of your css. See if that fixes things.
I updated: aside nav h1 .welcome and footer. By changing some of the header elements to use position:absolute and then using margin to space elements out. You will probably find the css is more compatible cross-browser/device.
#font-face { font-family: 'Constantia'; src: url('constantia/constantia.eot'); src: url('constantia/constantia.eot?#iefix') format('embedded-opentype'), url('constantia/constantia.svg#Constantia') format('svg'), url('constantia/constantia.woff') format('woff'), url('constantia/constantia.ttf') format('truetype'); font-weight: normal; font-style: normal;}
* {
margin-top: 0px;
margin-bottom: 0px;
}
html {
font-family: 'droid sans';
-webkit-font-smoothing: antialiased;
text-shadow: 1px 1px 1px rgba(0,0,0,0.004);
}
body {
width: 940px;
margin: 0 auto;
}
li {
list-style: none;
}
a {
text-decoration: none;
color: #ffffff;
}
a:hover {
text-decoration: underline;
}
header a:hover {
text-decoration: none;
}
h1 {
font-family: 'Constantia', helvetica;
position: absolute;
top: 20px;
}
header {
height: 140px;
position: relative;
margin-bottom: 40px;
}
nav {
width: 660px;
height: 30px;
background-color: #00788a;
position: absolute;
font-size: 1.2em;
bottom: 0;
right: 0;
}
nav li a {
color: #ffffff;
}
nav a:hover {
text-decoration: underline;
}
nav ul {
padding-left: 0px;
}
nav ul li {
display: inline;
line-height: 30px;
vertical-align: middle;
color: #ffffff;
padding-left: 70px;
padding-right: 65px;
}
aside {
height: 600px;
width: 240px;
float: left;
background-color: #00788a;
color: #ffffff;
clear: both;
position: relative;
text-align: center;
margin-bottom: 30px;
}
article a {
color: #00788a;
}
.contain {
width: 940px;
}
footer {
height: 100px;
clear: both;
background-color: #00788a;
color: rgba(255,255,255,0.5);
position: relative;
font-size: 0.85em;
padding: 0 10px;
line-height: 1.5em;
margin-top: 40px;
}
footer li {
display: inline;
border-left: 2px solid rgba(255,255,255,0.5);
padding: 0 5px;
}
footer li:first-child {
border: none;
}
footer ul {
padding-left: 0;
text-align: center;
}
.foot_fade {
color: rgba(255,255,255,0.5);
}
.first_initial {
font-size: 110px;
color: #00788a;
font-weight: lighter;
}
.second_initial {
font-size: 101px;
color: #00788a;
font-weight: lighter;
position: relative;
top: -6px;
}
.rest_of_title {
font-size: 26px;
position: relative;
left: -73px;
top: 20px;
font-weight: lighter;
}
header a {
color: #000000;
}
.header_background {
float: right;
position: relative;
z-index: -1;
}
.topbar {
width: 940px;
height: 30px;
background-color: #00788a;
}
.call_now {
padding: 10px 50px 10px 50px;
font-size: 1.5em;
line-height: 1.5em;
border-bottom: 5px solid #ffffff;
text-shadow: 2px 2px 2px #2a2a2a;
}
.home_service {
padding: 10px 40px 10px 40px;
font-size: 1.45em;
line-height: 1.5em;
border-bottom: 5px solid #ffffff;
text-shadow: 2px 2px 2px #2a2a2a;
}
.service_list {
font-size: 1.25em;
line-height: 3em;
text-align: left;
padding-top: 35px;
padding-left: 20px;
text-shadow: 2px 2px 2px #2a2a2a;
}
.welcome {
width: 660px;
float: right;
padding: 0px 0px 0px 40px;
font-size: 0.9em;
line-height: 2em;
color: #2a2a2a;
position: relative;
/* top: -95px; */
text-align: justify;
}
.services {
width: 660px;
float: right;
padding: 0px 0px 0px 40px;
position: relative;
top: -95px;
}
.services a {
text-decoration: none;
position: absolute;
top: 151px;
left: 0;
width: 275px;
color: #ffffff;
background-color: rgba(0,0,0,0.5);
padding: 10px 0 10px 10px;
}
.services div {
margin-bottom: 15px;
}
.services div:last-child {
margin-bottom: 0;
}
.savings_pic {
position: relative;
height: 190px;
width: 285px;
}
.retire_pic {
position: absolute;
top: 0;
right: 0;
height: 190px;
width: 285px;
}
.protection_pic {
position: relative;
height: 190px;
width: 285px;
}
.insurance_pic {
position: absolute;
top: 205px;
right: 0;
height: 190px;
width: 285px;
}
.mortgage_pic {
position: relative;
height: 190px;
width: 285px;
}
.retire {
width: 300px;
float: right;
margin: 0 0 10px 10px;
}
/*.shadow {
box-shadow: 0 0 3px 1px rgba(42,42,42,0.5);
margin: 3px 0;
}*/
.overlay {
background-color: rgba(0, 0, 0, 0.5);
bottom: 54px;
color: #FFFFFF;
padding: 10px;
position: relative;
width: 265px;
}
.overlay a {
text-decoration: none;
color: #ffffff;
}
.overlay a:hover {
}
.left {
float: left;
}
.right {
float: right;
}
.regulation {
font-style: italic;
color: #9a9a9a;
font-size: 0.9em;
}
.smallprint {
width: 520px;
font-size: 0.9em;
text-align: center;
position: absolute;
right: 210px;
top: 30px;
}
.copyright {
width: 310px;
margin: 0 auto;
}
.scapa {
position: absolute;
bottom: 0;
right: 10px;
font-size: 0.9em;
}

Side menu div height does not extend with main div

I have a .page <div> that surrounds all of the content inside. When the content stretches, so does the .page <div>.
My main issue is that the .leftBannerBackground <div> does not extend with the .page <div>.
Is there anything I can do to make the height of the .leftBannerBackground <div> extend with the .page <div>?
Short version of HTML:
<div class="page">
<div class="header">
<div class="top_banner">
</div>
<div class="title">
<h1 class="siteColor centeredText">
Header </h1>
</div>
</div>
<div class="leftBanner">
</div>
<div class="leftBannerBackground">
</div>
<div class="main">
<!-- Content goes here -->
<div class="leftSide">
</div>
<div class="rightSide" style="margin-top: 35px;"></div>
</div>
<div class="bottomFiller"></div>
<div class="footer">
</div>
</div>
CSS:
/* DEFAULTS
----------------------------------------------------------*/
body
{
background: #ffffff;
font-size: .80em;
font-family: "Helvetica Neue", "Lucida Grande", "Segoe UI", Arial, Helvetica, Verdana, sans-serif;
/*margin: 0px;*/
text-align:justify;
padding: 0px;
color: #000000;
/*height: auto !important;
height: 100%;
min-height: 100%;*/
}
p
{
margin-bottom: 10px;
line-height: 1.2em;
}
/* HEADINGS
----------------------------------------------------------*/
h1, h2, h3, h4, h5, h6
{
font-size: 1.5em;
color: #666666;
font-variant: small-caps;
text-transform: none;
font-weight: 200;
margin-bottom: 0px;
}
h1
{
font-size: 1.6em;
padding-bottom: 0px;
margin-bottom: 0px;
}
h2
{
font-size: 1.5em;
font-weight: 600;
}
h3
{
font-size: 1.2em;
}
h4
{
font-size: 1.1em;
}
h5, h6
{
font-size: 1em;
}
/* this rule styles <h1> and <h2> tags that are the
first child of the left and right table columns */
.rightColumn > h1, .rightColumn > h2, .leftColumn > h1, .leftColumn > h2
{
margin-top: 0px;
}
/* PRIMARY LAYOUT ELEMENTS
----------------------------------------------------------*/
.page
{
width: 960px;
background-color: #fff;
/* margin: 20px auto 0px auto;*/
border: 1px solid #496077;
position: absolute;
top: 20px;
left: 50%;
margin-left: -480px;
}
.header
{
position: relative;
margin: 0px;
padding: 0px;
background: #FFFFFF;
width: 100%;
}
.header h1
{
font-weight: 700;
margin: 0px;
padding: 0px 0px 0px 20px;
color: #f9f9f9;
border: none;
line-height: 2em;
font-size: 2em;
}
.main
{
position:relative;
padding: 4px 12px 8px 6px;
margin: 220px 0px 0px 150px;
width: 790px;
min-height:390px;
top: 10px;
overflow: auto;
}
.bottomFiller
{
min-height: 0px;
}
.leftCol
{
padding: 6px 0px;
margin: 12px 8px 8px 8px;
width: 200px;
min-height: 200px;
}
.footer
{
position: relative;
color: #ffffff;
padding: 8px 0px 0px 0px;
margin: 0px auto;
text-align: center;
line-height: normal;
background-color: #9B0707;
min-height: 20px;
/*margin-bottom: 40px;*/
}
.partners
{
position: relative;
width: 126px;
height: 46px;
bottom: 20px;
z-index:6800;
}
/* TAB MENU
----------------------------------------------------------*/
div.hideSkiplink
{
width:100%;
}
div.menu
{
position: relative;
padding: 0px 0px 0px 16px;
margin-top: 275px;
margin-bottom: 0%;
height: 100%;
/*top: 200px;
margin: 275px 0px;*/
}
div.menu ul li a, div.menu ul li a:visited
{
color: #FCE756; /* text color */
font-size:medium;
display: block;
list-style: none;
line-height: 1.95em;
padding: 4px 5px;
text-decoration: none;
white-space: nowrap;
}
div.menu ul li a:hover
{
color: #ffffff;
text-decoration: none;
}
/* FORM ELEMENTS
----------------------------------------------------------*/
fieldset
{
margin: 1em 0px;
padding: 1em;
border: 1px solid #ccc;
}
fieldset p
{
margin: 2px 12px 10px 10px;
}
fieldset.login label, fieldset.register label, fieldset.changePassword label
{
display: block;
}
fieldset label.inline
{
display: inline;
}
legend
{
font-size: 1.1em;
font-weight: 600;
padding: 2px 4px 8px 4px;
}
input.textEntry
{
width: 320px;
border: 1px solid #ccc;
}
input.passwordEntry
{
width: 320px;
border: 1px solid #ccc;
}
div.accountInfo
{
width: 42%;
}
/* MISC
----------------------------------------------------------*/
.siteColor
{
color: #9B0707 !important;
}
.centeredText
{
text-align: center;
}
.clear
{
clear: both;
}
.leftBannerSpaceFiller
{
position: relative;
float:left;
background-color:#9B0707;
height: 100%;
width:132px;
}
.title
{
display: block;
float: right;
text-align: left;
right: 250px;
width: auto;
position: absolute;
margin-top: 8px;
}
.top_banner
{
background-image: url('../Images/topBanner.png');
top: 66px;
left:50px;
height: 164px;
width: 911px;
position: absolute;
z-index: 6900;
}
.leftSide {
float:left;
width:468px;
}
.leftSidecont {
float:left;
width:790px;
}
.leftSideteam {
float:left;
width:540px;
}
.leftSideliens {
float:left;
width:268px;
}
.rightSide {
float:right;
width:300px;
}
.rightSidecont {
position: absolute;
width:400px;
}
.rightSideteam {
float:right;
width:228px;
}
.rightSideliens {
float:right;
width:500px;
}
.leftBanner
{
background-image: url('../Images/leftBanner.png');
height: 592px;
width: 52px;
margin-top: 30px;
position: absolute;
z-index: 3600;
}
.leftBannerBackground
{
position:relative;
background-color: #9B0707; /* #a40a0a; */
width:132px;
z-index: 1600;
float:left;
height: 100%;
margin-bottom: 0%;
}
.loginDisplay
{
font-size: 1.1em;
display: block;
text-align: right;
padding: 10px;
color: White;
}
.bold
{
font-weight: bold;
}
You have two options:
Use absolute positioning on .leftBannerBackground and set top: 0px; and bottom: 0px;. Demo: http://jsfiddle.net/ZXLNk/
Use height: 100%; on .leftBannerBackground (as you are already). But in order to get that to work you need to set the height of all containing elements to 100% as well: .page, <body>, and <html>. Of course that also means you won't be able to use absolute positioning on .page. Demo: http://jsfiddle.net/gLzcK/

Resources