Correct use of section article and heading - css

I wrote some code for an advanced liquid slider. But as my header slider contains some major content like h-tags p-tags and some images. I asked myself "can I consider each slide as an article". Because I can't find the correct answer maybe somebody can help me. The question is, is my code correctly nested and the right use of Semantic Elements. The code is:
<header id="masthead" class="site-header" role="banner">
<div id="main-slider" class="liquid-slider">
<article id="slider-1" class="liquid-slide-wrapper" style="background: url(images/back-99.jpg) 50% 50% /cover; repeat:no-repeat; min-height:450px;">
<section class="section-text-left">
<header>
<h1 class="title" style=" color:#f7740a; display:none;">Professionele, betaalbare website nodig?</h2>
<h2 style=" color:#fff; display:none;">Zelf uw website aanpassen?</h3>
</header>
<p style="display:none; color:#fff;">Onze unieke websites worden afgeleverd met een wordpress CMS systeem.<br>
Hiermee kan u zelf uw website aanpassen!<br> Vat de kudu bij de horens en contacteer ons voor meer info!
</p>
<p style="display:none;"><button type="button" class="btn btn-primary btn-lg">Mail Ons</button> <button type="button" class="btn btn-transparent btn-lg">0494 / 77 22 61</button></p>
</section>
<section class="section-img-right clearfix">
<img class="slider-img-right fadeInRight animated" style="display:none; width:100%; max-width:692px; height:auto;" src="images/imac.png" />
<img class="slider-img-right fadeIn animated-slow" style="display:none; width:100%; max-width:692px; height:auto;" src="images/straf-webdesign.png" />
<img class="slider-img-right fadeIn animated-slow" style="display:none; width:100%; max-width:692px; height:auto;" src="images/responsive-webdesign.png" />
</section>
</article>
<article id="slider-2" style="background: url(images/background-7.png) 50% 50% /cover; repeat:no-repeat; min-height:450px;">
<section class="section-text-left">
<header>
<h1 class="title" style=" color:#f7740a; display:none;">JustOnWeb wordt Kudu Concepts!</h2>
<h2 style="display:none; color:#000;">Een nieuwe naam, met een professionelere aanpak!</h3>
<header>
<p style="display:none; color:#fff;">Een website bestaat uit meer dan een lay-out. <br>Met kudu Concepts gaan we verder daar waar anderen stoppen!<br>
We bedenken een volledige filosofie voor uw website en <br> combineren dit met onze kennis van Online Marketing!
</p>
</section>
</article>
</div>
</header>

According to W3School semantic here : http://www.w3schools.com/html/html5_semantic_elements.asp
< section > contain < article >
it is not recommanded to use < section > inside < article > and inside < header >
According W3C, a section is "a thematic grouping of content, typically with a heading."
< header > is on top of parent element, so on top of body (the header) but also on top of sections or articles or any other div
In your code :
< h1 > should be close with < / h1 > and not h2, same for < h2 >

Related

CSS error caused by strange closing of divs

I've encountered a pretty weird CSS error which stops CSS from properly being applied. Check out the screenshot I took from the Chrome inspection tool.
Weird CSS in inspector
The code is pretty straightforward:
<div class="addownsong">
<span class="hidesongadder"><i class="fa fa-times"></i></span>
<h4>Artiest</h4>
<input id="artist-name" type="text" style="background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABHklEQVQ4EaVTO26DQBD1ohQWaS2lg9JybZ+AK7hNwx2oIoVf4UPQ0Lj1FdKktevIpel8AKNUkDcWMxpgSaIEaTVv3sx7uztiTdu2s/98DywOw3Dued4Who/M2aIx5lZV1aEsy0+qiwHELyi+Ytl0PQ69SxAxkWIA4RMRTdNsKE59juMcuZd6xIAFeZ6fGCdJ8kY4y7KAuTRNGd7jyEBXsdOPE3a0QGPsniOnnYMO67LgSQN9T41F2QGrQRRFCwyzoIF2qyBuKKbcOgPXdVeY9rMWgNsjf9ccYesJhk3f5dYT1HX9gR0LLQR30TnjkUEcx2uIuS4RnI+aj6sJR0AM8AaumPaM/rRehyWhXqbFAA9kh3/8/NvHxAYGAsZ/il8IalkCLBfNVAAAAABJRU5ErkJggg=="); background-repeat: no-repeat; background-attachment: scroll; background-size: 16px 18px; background-position: 98% 50%; cursor: auto;">
<h4>Titel</h4>
<input id="track-name" type="text">
<div class="minutes">
<h4>Minuten</h4>
<input id="track-minutes" type="text" min="0" max="59">
</div>
<div class="timedivider">
<h4>:</h4>
</div>
<div class="seconds">
<h4>Seconden</h4>
<input id="track-seconds" type="text" min="0" max="59">
</div>
<p><strong>Wil je een scanbare Spotify code toevoegen aan je topplaatje? Gebruik onderstaande zoekbalk om het juiste nummer te vinden!</strong></p>
<input style="text-align: center;border-color:#df0d84" id="songsearch2" type="text" placeholder="Vind je favoriete nummer op basis van titel">
<div id="songsearch2-results"></div>
<div id="selected-spotify-code"></div>
<input hidden="" id="uploaded-image">
<div class="dropzone dropzonebox dz-clickable" id="my-awesome-dropzone"><div class="dz-message" data-dz-message=""><span>Sleep een foto hierheen of klik om te uploaden</span></div></div>
<div style="color:#ff0000;margin-top:10px;"><center><strong>Let op: voor het beste resultaat, voeg je een vierkante foto toe</strong></center></div>
<div style="background-color:#ddd;color:#545454;border-color:#ddd;" class="createButton placeholderButton">Voeg eerst alle gegevens toe</div>
<div style="display: none;" class="createButton addCreation">Voeg je creatie toe!</div>
</div>
I tried uncovering closing/opening errors for divs, but they're all properly showing. Any ideas?

how to make an image use full height of it's parent in materialize Cards

I'm using materialize for my project, and I'm having a few problems with horizontal cards. The image I'm using has a height smaller than it's parent div so at the end of it, the background color is shown(problem image). I have tried to use max-width: 100% and max-height: 100% and nothing, also I tried to put the image as background-image in CSS instead of the img tag, but materialize hide the image if it doesn't detect the tag (problem with backgroung-image)
I know i should stretch an image, but its only a few px. And why i want to do this? bc it is ok if someone with a big screen sees it, but if i try to use a smaller screen, the text column on the right get taller, and the image stop covering the hole height of the row. This is what i want (image: how it should be)
Thanks for your time even if you didn't repy. Cheers from Chile.
Html code
<div class="col s12 m6 l4 offset-m3 options">
<div class="card">
<div class="topTitleCard"><h5 class="" >Opción 3 |</p></div>
<div class="card-image">
<img src="./content/araucaria_v2.jpg">
<div class="card-title">
<h4 class="white-text textShadow thicker-font">Viajando en el Bosque Milenario</h4>
</div>
<a rel="addtoCart" class="option3 btn-floating btn-large halfway-fab waves-effect waves-light mygreen" ><i class="material-icons">shopping_cart</i></a>
</div>
<div class="card-content">
<br>
<p>
Escoge el mirador que más te llene de paz, para que el día de mañana, puedán esparcir tus cenizas en el lugar que tu escogiste. Obten calma por siempre con el sonido del agua corriendo, o por el sonido de las copas de las Araucarias y Coihues moviendose por el viento.
Ver más...
</p>
</div>
<div>
<div class="card-tabs">
<h6 class="text-mygreen center-align">Ven y escoge tu vista para la eternidad:</h6>
<br>
<ul class="tabs tabs-fixed-width">
<li class="tab"><a class="whichTree active" value="1" href="#test3-1" style="color:#0F0F0F;">Mirador</a></li>
</ul>
</div>
<div class="card-content mygreen white-text myTabsCards">
<div id="test3-1">
<p>10 UF</p>
<a class="option3 waves-effect waves-light btn buyBtn" rel="addtoCart">Comprar</a>
</div>
<div class="bottomTabsPrices">
*precios validos hasta el 31/12/2019
</div>
</div>
</div>
</div>
</div>
CSS code (don't think is going to be useful, but here it's anyway):
.card-image{
margin-top:50px !important;
position: relative;
background-color: rgba(84,115,93,.5);
}
.card-image img{
max-width: 100%;
max-height:100%;
}
On your image put this css
width: 100%;
height: 100%;
object-fit:cover;
When using object-fit on image, you need to give it width and height properties. It won't work with max-width and max-height if width and height are not specified too.
It will always fill the parent of an image. It might cut it on sides but this depends of aspect ratio of image and parent.

CSS :before repeat issue

I set :before property on my footer but I'm facing a repeating issue. I mean my image from :before property is repeated a lot of and I don't know why :/
See on my website it will be easier to understand :)
http://iutdoua-webetu.univ-lyon1.fr/~p0902398/prestashop/index.php
Here is my code
/*Insertion image TDB footer*/
div.footer-container ::before{
ontent:url("../img/Tonnerre/img_tdb_footer.png");
}
/*Fin insertion image*/
<div class="footer-container">
<footer id="footer" class="container" data-nb-cols="6">
<div class="container">
<!-- Block Newsletter module-->
<section id="newsletter_block_left">
<h4>Lettre d'informations</h4>
<div class="block_content">
<form action="http://iutdoua-webetu.univ-lyon1.fr/~p0902398/prestashop/index.php" method="post">
<div class="form-group">
<input class="inputNew form-control newsletter-input placeholder" placeholder="Saisissez votre adresse e-mail" id="newsletter-input" type="text" name="email" size="18" value="">
<button type="submit" name="submitNewsletter" class="btn btn-default button button-small">
<span>ok</span>
</button>
<input type="hidden" name="action" value="0">
</div>
</form>
</div>
</section>
<!-- /Block Newsletter module-->
<section id="social_block" class="footer-block">
<h4 class="title_block">Nous suivre</h4>
<ul class="toggle-footer" style="">
<li class="facebook"><a class="_blank" href="https://www.facebook.com/tonnerredebelt/?fref=ts" target="_blank">Facebook</a></li>
</ul>
</section>
<!-- Block categories module -->
<section class="blockcategories_footer footer-block col-xs-12 col-sm-2">
<h4>Catégories</h4>
<div class="category_footer toggle-footer" style="">
<div class="list">
<ul class="tree dynamized" style="display: block;">
<li class="last">
<span class="grower CLOSE"> </span><a href="http://iutdoua-webetu.univ-lyon1.fr/~p0902398/prestashop/index.php?id_category=8&controller=category&id_lang=1" title="">
Produits
</a>
<ul style="display: none;">
<li>
<a href="http://iutdoua-webetu.univ-lyon1.fr/~p0902398/prestashop/index.php?id_category=10&controller=category&id_lang=1" title="Ceintures en cuir, noires, Bicolores, fantaisistes… Retrouvez tout l'univers de la marque celio* à travers sa E-boutique.">
Boucles
</a>
</li>
<li>
<a href="http://iutdoua-webetu.univ-lyon1.fr/~p0902398/prestashop/index.php?id_category=9&controller=category&id_lang=1" title="LIVRAISON &amp; RETOUR GRATUITS◅ Retrouvez les ceintures homme en ligne | Grand choix parmi plus de 1 500 marques sur...">
Bracelets
</a>
</li>
<li class="last">
<a href="http://iutdoua-webetu.univ-lyon1.fr/~p0902398/prestashop/index.php?id_category=7&controller=category&id_lang=1" title="Ceintures : profitez de toutes nos offres du catalogue ceintures sur Galerieslafayette.com. N'hésitez pas vos achats sont satisfaits ou remboursés pendant 30 ...">
Ceintures
</a>
</li>
</ul>
</li>
</ul>
</div>
</div> <!-- .category_footer -->
</section>
<!-- /Block categories module -->
<!-- MODULE Block footer -->
<section class="footer-block col-xs-12 col-sm-2" id="block_various_links_footer">
<h4>Informations</h4>
<ul class="toggle-footer" style="">
<li class="item">
<a href="http://iutdoua-webetu.univ-lyon1.fr/~p0902398/prestashop/index.php?controller=prices-drop" title="Promotions">
Promotions
</a>
</li>
<li class="item">
<a href="http://iutdoua-webetu.univ-lyon1.fr/~p0902398/prestashop/index.php?controller=new-products" title="Nouveaux produits">
Nouveaux produits
</a>
</li>
<li class="item">
<a href="http://iutdoua-webetu.univ-lyon1.fr/~p0902398/prestashop/index.php?controller=best-sales" title="Meilleures ventes">
Meilleures ventes
</a>
</li>
<li class="item">
<a href="http://iutdoua-webetu.univ-lyon1.fr/~p0902398/prestashop/index.php?controller=contact" title="Contactez-nous">
Contactez-nous
</a>
</li>
<li class="item">
<a href="http://iutdoua-webetu.univ-lyon1.fr/~p0902398/prestashop/index.php?id_cms=3&controller=cms&id_lang=1" title="Conditions d'utilisation">
Conditions d'utilisation
</a>
</li>
<li>
<a href="http://iutdoua-webetu.univ-lyon1.fr/~p0902398/prestashop/index.php?controller=sitemap" title="sitemap">
sitemap
</a>
</li>
<li>
© 2014 <a class="_blank" href="http://www.prestashop.com" target="_blank">Logiciel e-commerce par PrestaShop™</a>
</li>
</ul>
</section>
<!-- /MODULE Block footer -->
<!-- Block myaccount module -->
<section class="footer-block col-xs-12 col-sm-4">
<h4>Mon compte</h4>
<div class="block_content toggle-footer" style="">
<ul class="bullet">
<li>Mes commandes</li>
<li>Mes avoirs</li>
<li>Mes adresses</li>
<li>Mes informations personnelles</li>
</ul>
</div>
</section>
<!-- /Block myaccount module -->
<!-- MODULE Block contact infos -->
<section id="block_contact_infos" class="footer-block col-xs-12 col-sm-4">
<div>
<h4>Informations sur votre boutique</h4>
<ul class="toggle-footer" style="">
<li>My Company, 42 avenue des Champs Elysées
75000 Paris
France </li>
<li>
<span>0123-456-789</span>
</li>
<li>
<span>sales#yourcompany.com</span>
</li>
</ul>
</div>
</section>
<!-- /MODULE Block contact infos -->
<div id="block_facebook_like" class="block jq_slide_toggle">
<h4>Facebook</h4>
<div class="facebook-fanbox">
<div class="fb-like-box fb_iframe_widget" data-href="https://www.facebook.com/tonnerredebelt/?fref=ts" data-colorscheme="light" data-show-faces="true" data-header="false" data-stream="false" data-show-border="false" data-width="292" fb-xfbml-state="rendered" fb-iframe-plugin-query="app_id=334341610034299&color_scheme=light&container_width=288&header=false&href=https%3A%2F%2Fwww.facebook.com%2Ftonnerredebelt%2F%3Ffref%3Dts&locale=en_US&sdk=joey&show_border=false&show_faces=true&stream=false&width=292"><span style="vertical-align: bottom; width: 292px; height: 214px;"><iframe name="f1cfcf364c" width="292px" height="1000px" frameborder="0" allowtransparency="true" allowfullscreen="true" scrolling="no" title="fb:like_box Facebook Social Plugin" src="http://www.facebook.com/plugins/like_box.php?app_id=334341610034299&channel=http%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D42%23cb%3Df251877a6%26domain%3Diutdoua-webetu.univ-lyon1.fr%26origin%3Dhttp%253A%252F%252Fiutdoua-webetu.univ-lyon1.fr%252Ff3e4cbbb3%26relation%3Dparent.parent&color_scheme=light&container_width=288&header=false&href=https%3A%2F%2Fwww.facebook.com%2Ftonnerredebelt%2F%3Ffref%3Dts&locale=en_US&sdk=joey&show_border=false&show_faces=true&stream=false&width=292" class="" style="border: none; visibility: visible; width: 292px; height: 214px;"></iframe></span></div>
</div>
</div>
<!-- MODULE Block reinsurance -->
<div id="reinsurance_block" class="clearfix">
<ul class="width5">
<li><img src="http://iutdoua-webetu.univ-lyon1.fr/~p0902398/prestashop/modules/blockreinsurance/img/reinsurance-2-1.jpg" alt="Échange en magasin"> <span>Échange en magasin</span></li>
<li><img src="http://iutdoua-webetu.univ-lyon1.fr/~p0902398/prestashop/modules/blockreinsurance/img/reinsurance-3-1.jpg" alt="Paiement à l'expédition."> <span>Paiement à l'expédition.</span></li>
<li><img src="http://iutdoua-webetu.univ-lyon1.fr/~p0902398/prestashop/modules/blockreinsurance/img/reinsurance-4-1.jpg" alt="Livraison gratuite"> <span>Livraison gratuite</span></li>
<li><img src="http://iutdoua-webetu.univ-lyon1.fr/~p0902398/prestashop/modules/blockreinsurance/img/reinsurance-5-1.jpg" alt="Paiement 100% sécurisé"> <span>Paiement 100% sécurisé</span></li>
<li><img src="http://iutdoua-webetu.univ-lyon1.fr/~p0902398/prestashop/modules/blockreinsurance/img/" alt="Satisfait ou remboursé"> <span>Satisfait ou remboursé</span></li>
</ul>
</div>
<!-- /MODULE Block reinsurance -->
<a id="logo_footer" href="http://iutdoua-webetu.univ-lyon1.fr/~p0902398/prestashop/" title="Tonnerre De Belt">
<img class="logo" src="http://iutdoua-webetu.univ-lyon1.fr/~p0902398/prestashop/img/tonnerre-de-belt-logo-1447323498.jpg" alt="Tonnerre De Belt" width="1681">
</a>
</div>
</footer>
</div>
Thanks for helping :)
Alexis
The problem may be in your selector. You are doing this way in your site:
.footer-container *::before
{
content:url("../img/Tonnerre/img_tdb_footer.png");
}
See that * in your selector? It means that you want all child elements of .footer-container to have that css applied. You probably don't want it to work like this, I think.
Maybe you can try .footer-container::before to apply just before the elements that contains the .footer-container class, which is just one element.
You should do a background-image and background-repeat properties in your footer
.footer-container ::before {
content: " ";
background-image: url("../../img/Tonnerre/img_tdb_footer.png");
background-repeat: no-repeat;
}
Do not forget to add height and width to your element in before:
.footer-container ::before {
content: " ";
background: url("../../img/Tonnerre/img_tdb_footer.png") no-repeat;
height:100px;
width:100px;
background-size:100%;
}

Twitter Bootstrap 3 - Panels of Equal Height in a Fluid Row

I am new to Bootstrap 3 and I would like to have 3 panels on my landing page of equal height, even though the middle panel has less content. When resized they become the same height, but are not upon initial visit to the page.
I already tried hiding the overflow with CSS and it cuts off the bottom of the panel which isn't what I want, so I'm thinking I need to use jQuery.
Here is my code:
<div class="row-fluid">
<!--begin panel 1 -->
<div class="col-md-4">
<div style="text-align:center" class="panel panel-primary">
<div class="panel-heading">
<h1 class="panel-title text-center">Web y Metrícas</h1>
</div>
<!-- end panel-heading -->
<div class="panel-body">
<p>
<img style="margin: 0 auto;" class="img-responsive" src="web.png" height="30%" width="30%" alt="Web y Metrícas" />
</p>
<p class="text-left lead2">Apoyamos estratégicamente la presencia de tu empresa en el mundo digital, a través de la construcción de recursos web atractivos para tus clientes.</p>
<ul class="text-left">
<li>Web Corporativas</li>
<li>Tiendas Virtuales</li>
<li>Plataformas e-Learning</li>
<li>Arquitectura de Información</li>
<li>Google Analytics, SEO–SEM</li>
<li>Análisis de Competencia Digital</li>
<li>Data Mining</li>
</ul> <a class="btn btn-primary" href="#">Ver más »</a>
</div>
<!-- end panel-body -->
</div>
<!-- end panel-primary -->
</div>
<!--end col-md-4 -->
<!-- begin panel 2 -->
<div class="col-md-4">
<div style="text-align:center" class="panel panel-primary">
<div class="panel-heading">
<h1 class="panel-title">Gestíon de Redes Socials</h1>
</div>
<!-- end panel-heading -->
<div class="panel-body">
<p>
<img style="margin: 0 auto;" class="img-responsive" src="redes.png" height="30%" width="30%" alt="Gestíon de Redes Socials" />
</p>
<p class="text-left lead2">Crear una experiencia de marca excepcional a través de redes es más inteligente, rápida y las comunicaciones sociales serán más eficientes.</p>
<ul class="text-left">
<li>Compromiso</li>
<li>Publicación</li>
<li>Monitoreo</li>
<li>Analítica</li>
<li>Colaboración</li>
<li>CRM</li>
<li>Movil</li>
</ul> <a class="btn btn-primary" href="#">Ver más »</a>
</div>
<!-- end panel-body -->
</div>
<!-- end panel-primary -->
</div>
<!-- end col-md-4 -->
<!--begin panel 3 -->
<div class="col-md-4">
<div style="text-align:center" class="panel panel-primary">
<div class="panel-heading">
<h1 class="panel-title">Plan de Medios</h1>
</div>
<!-- end panel-heading -->
<div class="panel-body">
<p>
<img style="margin: 0 auto;" class="img-responsive" src="medios.png" height="30%" width="30%" alt="Plan de Medios" />
</p>
<p class="text-left lead2">Trabajamos en conjunto con la empresa para reforzar las fortalezas de su organización y las comunicamos de forma integral y con un mensaje claro.</p>
<ul class="text-left">
<li>Asesoría Comunicacional</li>
<li>RR.PP</li>
<li>Presencia de Marca</li>
<li>Clipping Digital</li>
<li>Manejo de Crisis</li>
<li>Lobby</li>
<li>Media Training</li>
</ul> <a class="btn btn-primary" href="#">Ver más »</a>
</div>
<!-- end panel-body -->
</div>
<!-- end panel-primary -->
</div>
<!-- end col-md-4 -->
</div>
<!-- end row -->
This can be done with CSS flexbox. Only minimal CSS is needed..
.equal {
display: -webkit-flex;
display: flex;
}
Just add .equal to your .row and flexbox does the rest.
http://www.codeply.com/go/BZA25rTY45
UPDATE: Bootstrap 4 uses flexbox so there is no need for the additional CSS.
http://www.codeply.com/go/0Aq0p6IcHs
Bootstrap's solution - add this css and add the class to your row:
.row-eq-height {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
It has a couple caveats, as posted at http://getbootstrap.com.vn/examples/equal-height-columns/, but it sounds like it'll be good enough for your case.
I also saw this answer here.
Update for dynamic number of columns
Bootstrap automatically wraps columns into new rows when you add more than can fit in one row, but this flexbox approach breaks this. To get flexbox to wrap, I've found you can do something like this:
-webkit-flex-flow: row wrap;
flex-flow: row wrap;
-webkit-align-content: flex-end;
align-content: flex-end;
This is awesome when you have a dynamic number of columns, or columns that change width according to the screen size. So you can have something like this:
<div class="row row-eq-height">
<div class="col-sm-6 col-md-4">Content...</div>
<div class="col-sm-6 col-md-4">Content...</div>
<div class="col-sm-6 col-md-4">Content...</div>
<div class="col-sm-6 col-md-4">Content...</div>
<div class="col-sm-6 col-md-4">Content...</div>
</div>
And it all lines up the way it's expected. Just watch out - it only works in newer browsers. More info here
If you're going to use the bootstrap grid, I don't think you're going to find an easy way to accomplish this without hacks like the following css.
This basically says. When the screen width is greater than the md breakpoint in bootstrap, give all the elements with panel-body class which are direct descendants of the column elements a minimum height of 420px which happens to be a "magic number" that works with your existing content.
Again, I think this is a really gross solution, but it "works" in a pinch.
#media (min-width: 992px) {
.col-md-4 > .panel > .panel-body {
min-height: 420px;
}
}
Here's a CSS-Tricks article Fluid Width Equal Height Columns which covers various ways (display: table & flexbox) to accomplish this. However, you might need to step away from the responsive bootstrap grid for this particular task.
Also, here's the Complete Guide to Flexbox
Haven't found any of these CSS methods to work in my case I am using images in my panels too instead I used a simple JQuery function to get the job done
window.onload = function resizePanel(){
var h = $("#panel-2").height();
$("#panel-1").height(h); // add a line like this for each panel you want to resize
}
Where the ids "panel-1" and and "panel-2" are in the panel tag choose the largest panel as the one you use to set h and call the function at the end of you html.
<body onresize = "resizePanel()">
I also make it so the function is called when if the window is resized by adding the onresize attribute to the body
this function finds the largest .panel-body height, then makes that the height of all my .panel-body elements.
function evenpanels() {
var heights = []; // make an array
$(".panel-body").each(function(){ // copy the height of each
heights.push($(this).height()); // element to the array
});
heights.sort(function(a, b){return b - a}); // sort the array high to low
var minh = heights[0]; // take the highest number
$(".panel-body").height(minh); // and apply that to each element
}
Now that all the panel-bodys are the same, the heights need to be cleared when the window resizes before running the "evenpanels" function again.
$(window).resize(function () {
$(".panel-body").each(function(){
$(this).css('height',""); // clear height values
});
evenpanels();
});
I add top and bottom paddings in style for the lower <div>.
<div class="xxx" style="padding: 8px 0px 8px 0px">
...
</div>
Because after all each case is different and you have to adjust according to the situation.
Chrome dev tool can be very useful in situations like this.

Full-width div with background color

On this page: http://www.tff-bvba.be, I need the grey background behind the picture to be full-width on all resolutions, and the text and picture to be centered on the screen. Everything works ok, except the fact that the background continues to the right, off the screen (scroll to the right, you'll see).
I spent 2 hours looking for a solution but found none that worked for me... This is my code:
HTML:
<div class="wide">
<div class="odd">
<div class="homeimage"><img src="http://www.tff-bvba.be/wp-content/uploads/2013/11/hugo- home.png" alt="hugo-home" class="alignright size-full wp-image-1283" /></div>
<div class="hometext"><h1>Slaag in je materiaalinnovatie</h1>
Plan je een complexe innovatie waarbij de <b>combinatie en vorm van materialen</b> essentieel is? Missen je medewerkers <i>knowhow</i> of heb je tijdelijk versterking nodig?<br /><br />TFF maximaliseert de slaagkans van je project door:
<ul>
<li><b>35 jaar ervaring</b> in slimme materiaalcombinaties</li>
<li>maximaal <b>draagvlak </b>bij je medewerkers</li>
<li>bewezen expertise in<b> technieken en processen</b></li>
</ul>
<a class="bttn" title="Slimme materiaalinnovatie" href="http://www.tff-bvba.be/materiaalinnovatie/">Ontdek ons aanbod</a>
</div>
</div>
</div>
CSS:
.wide {
text-align:left;
font-weight:bold;
background:#ebebeb;
margin-left:-100%;
margin-right:-100%;
margin-bottom: 60px;
height: 465px;
}
.odd {
background-color:#ebebeb;
clear:both;
width:900px;
padding:40px 0 27px 0;
margin: 0 auto;
}
.hometext {
float: left;
width: 500px;
}
.homeimage {
margin-top: 0px;
float: right;
}
Thanks for your help, much appreciated!
Stefaan
I've changed your html and css using firebug in real-time and it works look:
Your problem is the html, your .wide div are placed on the wrong place, i've placed it correctly, and changed a little the CSS, use these html and css:
HTML:
<div id="bdywrapper2">
<div class="wide">
<div class="odd">
<div class="homeimage"><img src="http://www.tff-bvba.be/wp-content/uploads/2013/11/hugo-home.png" alt="hugo-home" class="alignright size-full wp-image-1283"></div>
<div class="hometext">
<h1>Slaag in je materiaalinnovatie</h1>
<p>Plan je een complexe innovatie waarbij de <b>combinatie en vorm van materialen</b> essentieel is? Missen je medewerkers <i>knowhow</i> of heb je tijdelijk versterking nodig?</p>
<p>TFF maximaliseert de slaagkans van je project door:</p>
<ul>
<li><b>35 jaar ervaring</b> in slimme materiaalcombinaties</li>
<li>maximaal <b>draagvlak </b>bij je medewerkers</li>
<li>bewezen expertise in<b> technieken en processen</b></li>
</ul>
<p><a class="bttn" title="Slimme materiaalinnovatie" href="http://www.tff-bvba.be/materiaalinnovatie/">Ontdek ons aanbod</a>
</p></div>
</div>
</div>
<!-- Start of main -->
<div class="main">
<div class="clear"></div>
<!-- Start of dynamic loop -->
<div class="dynoloop">
<!-- ******************************************************************** This is the start of blog loop ********************************************************************-->
<!-- Start of one half first -->
<div class="blog_one_half_first">
<!-- Start of slider wrapper -->
<section class="slider_wrapper">
<!-- Start of slider -->
<section style="overflow: hidden;" class="slider">
<ul style="width: 800%; margin-left: -412px;" class="slides"><li style="width: 412px; float: left; display: block;" class="clone">
<h3>Een tevreden klant vertelt…</h3>
<br>
<p>“Mayser/M.Pore ontwikkelt en produceert metaalschuimen voor toepassingen zoals LED-koeling. TFF beschikt over jarenlange ervaring op dit domein. Ze assisteren ons dagelijks op vlak van kwaliteit, productiviteit en creativiteit.” – Manfred Jordan, CEO Mayser/M.Pore</p>
<p>Meer klanten</p>
</li>
<li style="width: 412px; float: left; display: block;">
<h3>Daarom werk je met ons</h3>
<br>
<h2>Daarom werk je met ons</h2>
<p>1. Unieke ervaring: <b>materiaalinnovatie + bedrijfsvoering</b></p>
<p>
2. <b>Snelle terugverdientijd</b> door interim dividenden</p>
<p>3. Mensgerichte aanpak: <b>draagvlak bij stakeholders</b><br>
Overtuig jezelf</p>
</li>
<li style="width: 412px; float: left; display: block;">
<h3>Een tevreden klant vertelt…</h3>
<br>
<p>“Mayser/M.Pore ontwikkelt en produceert metaalschuimen voor toepassingen zoals LED-koeling. TFF beschikt over jarenlange ervaring op dit domein. Ze assisteren ons dagelijks op vlak van kwaliteit, productiviteit en creativiteit.” – Manfred Jordan, CEO Mayser/M.Pore</p>
<p>Meer klanten</p>
</li>
<li style="width: 412px; float: left; display: block;" class="clone">
<h3>Daarom werk je met ons</h3>
<br>
<h2>Daarom werk je met ons</h2>
<p>1. Unieke ervaring: <b>materiaalinnovatie + bedrijfsvoering</b></p>
<p>
2. <b>Snelle terugverdientijd</b> door interim dividenden</p>
<p>3. Mensgerichte aanpak: <b>draagvlak bij stakeholders</b><br>
Overtuig jezelf</p>
</li></ul>
<ol class="flex-control-nav"><li><a class="active">1</a></li><li><a>2</a></li></ol><ul class="flex-direction-nav"><li><a class="prev" href="#">Prev</a></li><li><a class="next" href="#">Next</a></li></ul></section><!-- End of slider -->
<!-- Start of clear fix --><div class="clear"></div>
</section><!-- End of slider wrapper -->
</div><!-- End of one half first -->
<!-- Start of one half -->
<div class="blog_one_half">
<!-- Start of slider wrapper -->
<section class="slider_wrapper">
<!-- Start of slider -->
<section class="slider">
<ul class="slides">
<li style="display: list-item;">
<h3>Een tevreden klant vertelt…</h3>
<br>
<h2>Een tevreden klant vertelt…</h2>
<p>
“Mayser/M.Pore ontwikkelt en produceert metaalschuimen voor toepassingen zoals LED-koeling. TFF beschikt over jarenlange ervaring op dit domein. Ze assisteren ons dagelijks op vlak van kwaliteit, productiviteit en creativiteit.” – Manfred Jordan, CEO Mayser/M.Pore<br>
Meer klanten</p>
</li>
</ul>
</section><!-- End of slider -->
<!-- Start of clear fix --><div class="clear"></div>
</section><!-- End of slider wrapper -->
</div><!-- End of one half -->
<!-- ******************************************************************** This is the emd of blog loop ********************************************************************-->
<div class="clear"></div>
</div><!-- End of dynamic loop -->
</div><!-- End of main -->
<!-- Start of accent bottom -->
<div class="accentbottom">
<!-- Start of accent top -->
<div class="accenttop">
</div><!-- End of accent top -->
</div><!-- End of accent bottom -->
</div>
CSS:
.wide {
text-align:left;
font-weight:bold;
background:#ebebeb;
margin-bottom: 60px;
width: 100%;
height: 465px;
}
Try Below CSS
.main {
margin: 0 auto;
padding-bottom: 60px;
width: 100%;
}
.wide {
background-color: #EBEBEB;
font-weight: bold;
height: 465px;
text-align: left;
}
Simple changes will do the trick for you
remove
margin-left:-100%;
margin-right:-100%;
from class .wide and give odd class 100% width instaed of 900px
Your CSS at present is stretching the bg....!!
EDIT :
edit after the comment : use a wrapper class to wrap your entire text and images, put odd to width:100%, this will ensure better compatibility and ease of CSS flow
HTML
<div class="odd">
<div class="wrapper">
<div class="homeimage">
<img src="" class="alignright size-full wp-image-1283" />
</div>
<div class="hometext">
</div>
</div> <!-- //wrapper -->
</div><!-- //odd-->
CSS
.wrapper{width:90%;margin:0 auto} // this will center the div and not take whole width at the same time

Resources