I have been looking everywhere for help on this issue with Css layout width I have been ruing into.
Whenever I float a div to the right its width won't automatically adjust to the total width of its children. I have observed this effect on all common browsers (Firefox, Chrome and IE11/Edge). What happens is that the last child will just be displayed bellow all the others which is what I do not want.
Here is the css and html I have been using.
https://jsfiddle.net/xqpf9s95/1/
<div id="header-container">
<div id="header-top-container">
<div id="header-logo">
<a href="/GlobalImagens/pages/imagens.xhtml?categoria=ultima-hora">
<img src="../resources/images/logo_globalimagens.jpg" alt="Global Imagens"></a>
</div>
<div class="header-top-right-coer">
<form id="language" name="language" method="post" action="/GlobalImagens/pages/imagens.xhtml" enctype="application/x-www-form-urlencoded">
<input name="language" value="language" type="hidden">
<div id="newsletter" class="newsletter">
<a href="http://72.e-goi.com/w/Te1LetVmefgyM9g90LOh" target="_blank" style="font-size: 10px;">Subscrever Newsletter</a>
</div>
<div style="float: right; padding-left: 6%;">
<script type="text/javascript" src="/GlobalImagens/javax.faces.resource/jsf.js.xhtml?ln=javax.faces&stage=Development"></script>
<a href="#" style="text-decoration:none; " onclick="mojarra.jsfcljs(document.getElementById('language'),{'language:j_idt31':'language:j_idt31','localeCode':'en'},'');retu false">
<img src="../resources/images/flag_uk.jpg" border="0"></a>
</div>
<div style="float: right;">
<a href="#" style="text-decoration:none;" onclick="mojarra.jsfcljs(document.getElementById('language'),{'language:j_idt35':'language:j_idt35','localeCode':'pt'},'');retu false">
<img src="../resources/images/flag_pt.jpg" border="0"></a>
</div>
<input name="javax.faces.ViewState" id="j_id1:javax.faces.ViewState:0" value="215900126811062761:3093351618596041247" autocomplete="off" type="hidden">
</form>
</div>
<div id="admin-container">
<div>
<span class="admin-menu1" style="padding-left: 1.5%;"><a href="/GlobalImagens/pages/entrar.xhtml" title="Iniciar Sessão">Iniciar Sessão</a>
</span>
<span class="dotted-separator"></span>
<span style="padding-left: 1.5%;"><a href="/GlobalImagens/pages/registo.xhtml" title="Registo">Registo</a>
</span>
<span class="admin-menu3"><a href="/GlobalImagens/pages/entrar.xhtml">
<img src="../resources/images/bt_minhaconta.jpg" title="A Minha conta" alt="A Minha conta"></a>
</span>
<span class="dotted-separator"></span>
<span class="admin-menu4"><a href="/GlobalImagens/pages/entrar.xhtml">
<img src="../resources/images/bt_carrinho.jpg" title="Meu carrinho" alt="Meu carrinho"></a>
</span>
</div>
<div>
<div align="right">
<span style="color: #83266f; padding-right: 5px;">Não pode adquirir imagens</span><a href="/GlobalImagens/pages/consumos.xhtml" style="color:#83266f;" title="detalhes">(detalhes)</a>
</div>
</div>
</div>
</div>
@charset "utf-8";
body {
background: url(../images/background_header_ext.png) repeat-x;
margin: 0px;
padding: 0px;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
}
#wrapper {
margin: 0 auto;
max-width: 960px;
}
#site-content {
width: 100%;
}
.highlights_title {
font-size: 17px;
font-weight: bold;
margin: 0px;
}
.top_title {
font-size: 17px;
font-weight: bold;
color: #83256f;
margin: 0px;
}
.registo_links a {
color: #c978a7;
}
.sidebar a {
color: #C978A7;
font-weight: bold;
text-decoration: none;
}
.sidebar a:hover {
color: #C978A7;
font-weight: bold;
text-decoration: underline;
}
.search_textfield {
left: 1px;
top: 1px;
width: 110px;
padding: 6px 5px 5px 4px;
margin-right: 5px;
height: 13px;
border: none;
font-size: 12px;
color: #636162;
}
.search_ok {
width: 25px;
height: 26px;
background: url(../images/background_ok.png) no-repeat;
border: none;
}
.form {
margin: 0px;
padding: 0px;
}
/*tables header*/
.admin-menu1 {
padding-right: 1.5%;
}
.dotted-separator {
border: none;
border-left: 1px dotted #83256f;
color: #fff;
/* background-color:#dadada;
height:17px;
width:0%;
margin: 0%; */
}
.admin-menu2 {
padding-left: 10px;
background: url(../images/background_dot.jpg) no-repeat right;
}
.admin-menu-logged-in-3 {
padding-left: 1.5%;
}
.admin-menu3 {
/* width: 75px; */
}
.admin-menu4 {
/* width: 28px; */
}
div.image-container {
float: left;
width: 198px;
height: 385px;
padding-left: 0;
}
div.image-container-no-details {
float: left;
width: 198px;
height: 245px;
padding-left: 0;
}
/*tables nav*/
.nav1 {
width: 32px;
border: solid 1px #9e9e9e;
color: #83256f;
text-align: center;
}
/*lista carrinho*/
.lista-carrinho1 {
background: #f5f5f5;
border: solid 1px #e9e9e9;
}
.lista-carrinho2 {
height: 158px;
width: 250px;
}
.lista-carrinho3 {
width: 58px;
}
.lista-carrinho4 {
border-top: solid 1px #e9e9e9;
border-bottom: solid 1px #e9e9e9;
border-right: solid 1px #e9e9e9;
}
.lista-carrinho5 {
color: #3a3a3a;
width: 220px;
font-size: 11px;
margin-left: 10px;
margin-right: 10px;
}
.lista-menu {
float: left;
width: 180px;
padding: 0;
}
.lista-menu1 {
background: url(../images/background_dot2.jpg) repeat-x bottom;
color: #C978A7;
font-size: 12px;
text-align: left;
}
.lista-menu2 {
color: #3a3a3a;
font-size: 11px;
padding-top: 10px;
padding-bottom: 10px;
vertical-align: top;
text-align: left;
}
.lista-menu3,
.lista-menu3-dark-border {
background: #ededed;
border-width: 0px;
border-color: #e4e4e4;
border-style: solid;
width: 180px;
height: 180px;
vertical-align: middle;
}
.lista-menu3-carousel,
.lista-menu3-dark-border-carousel {
background: #ededed;
border-width: 1px;
border-color: #e4e4e4;
border-style: solid;
width: 140px !important;
height: 140px !important;
vertical-align: middle;
}
.lista-menu3-dark-border {
background: #545454;
}
.lista-menu3-dark-border-carousel {
background: #545454;
}
.lista-menu4 {
background: url(../images/background_dot.jpg) no-repeat right;
}
.lista-menu-por-direitos {
font-size: 9px;
}
.tables-links a {
font-family: Arial;
text-decoration: none;
}
.tables-links-carrinho input {
vertical-align: middle;
text-decoration: none !important;
border: none;
}
.tables-links-carrinho img {
vertical-align: middle;
text-decoration: none;
margin-left: 4px;
margin-right: 4px;
border: none;
}
.tables-links-carrinho a {
text-decoration: none;
border: none;
}
.tables-links-descarregar a {
margin-right: 20px;
;
text-decoration: none;
font-weight: bold;
color: #c978a7;
}
.tables-links a:hover {
text-decoration: underline;
font-weight: bold;
color: #c978a7;
}
/*lista minha conta*/
.lista-minha-conta1 {
border: solid 1px #e9e9e9;
}
/*******************************HEADER*******************************/
#header-container {
/* height: 180px; */
/* float: left; */
}
#header-top-container {
/* width: 983px; */
/* height: 100px; */
/* float: left; */
}
#header-logo {
padding-top: 1%;
float: left;
}
#header-logo img {
border: none;
border-style: none;
}
.newsletter {
float: left;
padding-top: 1%;
}
.header-top-right-coer {
float: right;
padding-top: 1%;
width: 11%;
}
#admin-container {
padding-top: 1%;
font-size: 10px;
clear: right;
float: right;
box-sizing: border-box;
}
#admin-container a {
text-decoration: none;
color: #493641;
}
#admin-container a:hover {
text-decoration: underline;
}
#header-bottom-container {
width: 985px;
height: 30px;
margin-top: 10px;
color: #ffffff;
font-size: 13px;
font-weight: bold;
float: left;
}
#header-bottom-search {
width: 165px;
height: 28px;
float: left;
}
#header-bottom-menu {
height: 26px;
padding-top: 5px;
padding-left: 77px;
}
#header-bottom-menu ul {
margin-top: 0px;
margin-left: 30px;
padding-left: 55px;
height: 26px;
}
#header-bottom-menu li {
height: 26px;
display: inline;
padding-left: 12px;
padding-right: 8px;
background: url(../images/background_menuseparador.jpg) no-repeat left bottom;
float: left;
}
#header-bottom-menu li:first-child {
background: none;
}
#header-bottom-menu li a {
height: 26px;
text-decoration: none;
color: #ffffff;
}
#header-bottom-menu li a:hover {
text-decoration: underline;
}
#header-bottom-breadcrumb {
width: 974px;
height: 16px;
margin-top: 9px;
margin-left: 5px;
font-size: 11px;
float: left;
text-align: left;
color: #999;
}
#header-bottom-breadcrumb a {
color: #999;
text-decoration: none;
}
/*******************************CONTENT*******************************/
/***** NEW CLASSES ***/
div.content-spacing-top {
height: 40px;
width: inherit;
}
div.form-spacing {
height: 10px;
}
div.label {
text-align: left;
}
.required {}
div.label>div:NTH-CHILD(even) {
margin-top: 5px;
padding-left: 20px;
}
input.postalCode1 {
width: 30px;
}
input.postalCode2 {
width: 22px;
}
div.triplecolumn {
text-align: left;
width: 600px;
height: 43px;
}
div.triplecolumn>div {
margin-top: 0px;
float: left;
padding-left: 20px;
}
div.triplecolumn>div>div:FIRST-CHILD {
font-size: 12px;
font-weight: bold;
color: #83256f;
text-align: left;
}
div.triplecolumn>div>div:NTH-CHILD(even) {
margin-top: 5px;
padding-left: 0px;
}
.output-label {
padding-left: 20px;
font-size: 12px;
font-weight: bold;
color: #83256f;
text-align: left;
}
#content-container {
width: 974px;
float: left;
}
#content-title-container {
width: 974px;
height: 52px;
background: url(../images/background_title.jpg) repeat-x;
float: left;
}
#content-title {
width: 921px;
height: 32px;
margin-top: 7px;
padding-left: 17px;
text-align: left;
font-size: 12px;
font-weight: bold;
color: #999999;
float: left;
}
#content-entrada-images {
width: 974px;
height: 317px;
float: left;
}
#content-entrada-larger-image {
float: left;
}
#content-entrada-larger-image img {
height: 316px;
width: 476px;
}
#content-entrada-smaller-images-container {
width: 494px;
height: 317px;
padding-left: 3px;
float: left;
}
#content-entrada-smaller-image-n-container {
float: left;
height: 102px;
width: 156px;
}
#content-entrada-smaller-image-1-container {
width: 159px;
height: 106px;
float: left;
}
#content-entrada-smaller-image-n {
background: #FFF;
width: 157px;
height: 104px;
float: left;
}
#content-entrada-smaller-image-1 {
width: 157px;
height: 104px;
background: #FFF;
float: left;
}
#content-entrada-smaller-image-2-container {
width: 159px;
height: 106px;
float: left;
}
#content-entrada-smaller-image-2 {
width: 157px;
height: 104px;
background: #e9c9dc;
float: left;
}
#content-entrada-smaller-image-3-container {
width: 159px;
height: 106px;
float: left;
}
#content-entrada-smaller-image-3 {
width: 157px;
height: 104px;
background: #e9c9dc;
float: left;
}
#content-entrada-smaller-image-4-container {
width: 159px;
height: 106px;
float: left;
}
#content-entrada-smaller-image-4 {
width: 157px;
height: 104px;
background: #e9c9dc;
float: left;
}
#content-entrada-smaller-image-5-container {
width: 159px;
height: 106px;
float: left;
}
#content-entrada-smaller-image-5 {
width: 157px;
height: 104px;
background: #e9c9dc;
float: left;
}
#content-entrada-smaller-image-6-container {
width: 159px;
height: 106px;
float: left;
}
#content-entrada-smaller-image-6 {
width: 157px;
height: 104px;
background: #e9c9dc;
float: left;
}
#content-entrada-smaller-image-7-container {
width: 159px;
height: 106px;
float: left;
}
#content-entrada-smaller-image-7 {
width: 157px;
height: 104px;
background: #e9c9dc;
float: left;
}
#content-entrada-smaller-image-8-container {
width: 159px;
height: 106px;
float: left;
}
#content-entrada-smaller-image-8 {
width: 157px;
height: 104px;
background: #e9c9dc;
float: left;
}
#content-entrada-smaller-image-9-container {
width: 159px;
height: 106px;
float: left;
}
#content-entrada-smaller-image-9 {
width: 157px;
height: 104px;
background: #e9c9dc;
float: left;
}
#content-listamenu-container {
width: 974px;
margin-top: 30px;
float: left;
}
#content-informacoes-container {
width: 974px;
margin-top: 30px;
float: left;
font-size: 12px;
font-family: Arial, Helvetica, sans-serif;
}
#content-minhaconta-lista-container {
margin-top: 30px;
width: 766px;
font-size: 11px;
float: left;
}
#content-registo-container {
/*registo*/
width: 954px;
margin-top: 32px;
padding-bottom: 30px;
float: left;
}
#content-registo-left-container {
width: 460px;
padding-left: 20px;
padding-right: 70px;
font-size: 11px;
color: #000000;
float: left;
}
#content-registo-left-container a {
color: #c978a7;
}
#content-sidebar-container {
margin-top: 30px;
margin-left: 30px;
width: 175px;
background: #ededed;
border: solid 1px #e9e9e9;
float: left;
}
#content-sidebar {
width: 144px;
margin-top: 35px;
padding-left: 16px;
padding-bottom: 34px;
font-size: 11px;
color: #393737;
float: left;
}
#content-sidebar2-container {
width: 175px;
background: #ededed;
border: solid 1px #e9e9e9;
float: left;
}
#content-nav-top-container {
width: 974px;
height: 34px;
border-top: solid 1px #999999;
border-bottom: solid 1px #999999;
float: left;
}
#content-nav-top-left {
width: 510px;
height: 20px;
margin-top: 7px;
padding-left: 10px;
text-align: left;
font-size: 11px;
color: #636162;
float: left;
font-weight: bold;
overflow: hidden;
}
#content-nav-top-left select {
cursor: pointer;
margin-left: 5px;
border: 0;
color: #83256F;
font-weight: bold;
font-size: 11px;
font-family: Arial, Helvetica;
}
#content-nav-top-left-sort-by,
#content-nav-top-left-results-per-page,
#content-nav-top-left-show-image-details,
#content-nav-top-left-month {
margin-left: 30px;
height: 20px;
text-align: left;
font-size: 11px;
color: #636162;
float: left;
}
#content-nav-top-left-day {
margin-left: 0px;
height: 20px;
text-align: left;
font-size: 11px;
color: #636162;
float: left;
}
#content-nav-top-left-sort-by,
#content-nav-top-left-show-image-details {
margin-left: 0px;
}
#content-nav-top-left-results-per-page {
width: 140px;
}
#content-nav-top-left-show-image-details {
width: 140px;
}
#content-nav-top-left a {
text-decoration: none;
font-weight: bold;
color: #a56496;
}
#content-nav-top-left a:hover {
text-decoration: underline;
}
#content-nav-top-right {
width: 167px;
height: 25px;
margin-top: 5px;
padding-right: 10px;
font-size: 11px;
color: #83256f;
float: right;
}
#content-nav-top-right img {
border-style: none;
}
#content-nav-container {
/*nav bottom*/
width: 974px;
height: 34px;
margin-top: 9px;
border-top: solid 1px #999999;
border-bottom: solid 1px #999999;
float: left;
}
#content-nav-left {
width: 300px;
height: 20px;
margin-top: 10px;
padding-left: 10px;
text-align: left;
font-size: 11px;
color: #636162;
float: left;
}
#content-nav-left a {
text-decoration: none;
font-weight: bold;
color: #a56496;
}
#content-nav-left a:hover {
text-decoration: underline;
}
#content-nav-right {
width: 167px;
height: 25px;
margin-top: 5px;
padding-right: 10px;
font-size: 11px;
color: #83256f;
float: right;
}
#content-nav-right img {
border-style: none;
}
#highlights-container,
#homepage-highlights-container {
width: 974px;
height: 159px;
margin-top: 11px;
background-color: #83256F;
float: left;
}
#homepage-highlights-container {
margin-top: 1px;
}
#highlights-left {
width: 415px;
height: 122px;
margin-top: 18px;
padding-left: 10px;
background: url(../images/highlights_separator.png) repeat-y right;
text-align: justify;
font-size: 11px;
color: #ffffff;
float: left;
}
#highlights-left a {
text-decoration: underline;
color: #e9c9dc;
font-weight: bold;
}
#highlights-right {
width: 480px;
height: 122px;
padding-left: 17px;
margin-top: 18px;
text-align: justify;
font-size: 11px;
color: #ffffff;
float: left;
}
#highlights-right a {
text-decoration: underline;
color: #e9c9dc;
font-weight: bold;
}
/*******************************FOOTER*******************************/
#footer-controlinveste {
float: left;
}
#footer-container {
height: 160px;
background: url(../images/background_footer.jpg) top repeat-x;
clear: both;
float: left;
}
#footer-signature {
width: 974px;
height: 20px;
margin-top: 9px;
font-size: 11px;
color: #83256f;
text-align: left;
}
#footer-signature a {
text-decoration: none;
color: #83256f;
}
#footer-signature a:hover {
text-decoration: underline;
color: #83256f;
}
#footer-acap {
width: 953px;
height: 15px;
margin-top: 13px;
padding-left: 30px;
text-align: right;
float: left;
}
#footer-anuncios-controlinveste-container {
width: 843px;
height: 100px;
margin-top: 20px;
padding-left: 140px;
text-align: center;
float: left;
}
#footer-anuncios-controlinveste {
width: 704px;
height: 88px;
background: #efefef;
float: left;
}
#footer-links {
width: 974px;
height: 65px;
float: left;
padding-left: 30px;
}
#footer-links a {
text-decoration: none;
color: #000000;
}
.footer-links a:hover {
text-decoration: underline;
color: #000000;
}
#generic-footer-container {
width: 974px;
}
#content-no-results {
width: 974px;
height: 265px;
float: left;
vertical-align: middle;
text-align: center;
font-size: 17px;
font-weight: bold;
color: #83256F;
}
#ier-content-no-results img {
cursor: pointer;
}
.search-textfield-no-results {
left: 1px;
top: 1px;
width: 200px;
padding: 6px 5px 5px 4px;
margin-right: 5px;
height: 13px;
border: 1px solid #636162;
font-size: 12px;
color: #636162;
vertical-align: top;
}
#ier-content-no-results {
margin-top: 70px;
padding: 10px;
}
input.direct-page-input {
width: 25px;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
text-align: center;
}
.lista-menu1-nome-imagem {
width: 58px;
height: 32;
align: left;
}
.lista-menu1-icones {
width: 110px;
height: 32px;
text-align: right;
text-decoration: none !important;
}
.lista-menu1-icones a {
text-decoration: none;
border-style: none;
}
.lista-menu1-icones img {
border-style: none;
}
table.account-and-cart-image-table {
width: 760px;
}
.temporary-text {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #83256F;
}
/****************/
/**** POP UP ****/
/****************/
#pop-up {
width: 840px;
height: 476px;
}
.pop-up-container {
width: 840px;
height: 474px;
}
.pop-up-left-side-web-image {
height: 474px;
width: 474px;
float: left;
background: #EDEDED;
border-width: 1px;
border-color: #E4E4E4;
border-style: solid;
}
.pop-up-left-side-web-image img {
vertical-align: middle;
}
.pop-up-left-side-web-image table {
padding: 0;
border: 0;
border-spacing: 0px;
}
.pop-up-right-side-info {
margin-left: 15px;
margin-top: 45px;
float: left;
width: 333px;
background: url(../images/background_dot2.jpg) repeat-x bottom;
}
.pop-up-right-side-info-title {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
float: left;
width: 100px;
color: #C978A7;
text-align: left;
margin-bottom: 5px;
}
.pop-up-right-side-info-buttons {
float: left;
text-align: right;
width: 230px;
color: #83256F;
margin-bottom: 5px;
}
.pop-up-right-side-info-buttons a {
text-decoration: none !important;
}
.pop-up-right-side-info-buttons img {
border-style: none;
}
.pop-up-right-side-info-text {
margin-left: 15px;
margin-top: 20px;
float: left;
width: 333px;
height: 150px;
color: #3A3A3A;
font-size: 11px;
text-align: left;
}
.pop-up-right-side-carousel {
margin-left: 25px;
margin-top: 75px;
float: left;
width: 320px;
text-align: left;
}
.pop-up-dialog {
float: left;
background: #EDEDED;
padding: 15px;
font-size: 12px;
font-family: Arial, Helvetica, sans-serif;
border-style: none;
text-align: left;
}
.pop-up-dialog a {
border-style: none;
text-decoration: none;
}
#open-pop-up-terms-and-conditions {
font-size: 11px;
font-weight: bold;
font-family: Arial, Helvetica, sans-serif;
color: #C978A7;
padding: 10px;
}
.pop-up-dialog-button {
font-size: 12px;
font-weight: bold;
font-family: Arial, Helvetica, sans-serif;
color: white;
background-color: #83256F;
padding: 7px;
height: 15px;
margin-left: 5px;
margin-right: 5px;
}
#lista-slideshow {
background: #ededed;
border-width: 1px;
border-color: #e4e4e4;
border-style: solid;
width: 100px;
height: 100px;
vertical-align: middle;
}
#consumption_table th {
background-color: #83256F;
color: white;
font-size: 12px;
}
#consumption_table tr,
#consumption_table td {
background-color: #E4E4E4;
text-align: center;
font-size: 11px;
}
#rss_link {
border: 0 none;
text-decoration: none;
}
#rss_link img {
border: 0 none;
text-decoration: none;
}
#rss_footer {
float: left;
border: 0 none;
margin-right: 5px;
margin-top: -2px;
}
#rss_footer img {
border: 0 none;
text-decoration: none;
}
div.homepage {
height: 483px;
}
a.ver-mais {
text-align: justify;
font-size: 11px;
color: #3A3A3A;
}
.titulo-carrossel {
text-align: left;
font-size: 24px;
font-weight: bold;
}
#newsletter a {
text-decoration: none;
color: #493641;
}
#newsletter a:hover {
text-decoration: underline;
}
And my issue is with the div "#admin-container".
How do I fix this so as to make that div auto adjust to the correct width and display without breaking its children elements?
Cheers and thank you.
