html - How to stop a div from inheriting parent css style -
i have 2 .scss stylesheets contributing 1 website. can have base, , home stylesheet.
in base style sheet, div has float of left, in section there no float. cant seem fix issue. advice appreciated!
here jsfiddle - https://jsfiddle.net/hbyeyv6y/
here base .scss -
body, html, div, nav, section, ul, li, header { float: left; margin: 0px; padding: 0px; }
here .scss -
div.whatwedo { box-sizing: border-box; margin: 0 auto; background-color: #366e81; padding: 100px; text-align: center; width: 100%; } div.whatwedo .inner { float: none; } div.whatwedo h1 { color: #ffffff; font-family: 'franklin gothic', 'arial', 'sans serif'; font-weight: lighter; font-size: 45px; } div.whatwedo h2 { margin-top: -15; color: #8e8e8e; font-family: 'franklin gothic', 'arial', 'sans serif'; font-weight: lighter; font-size: 25px; } div.whatwedo h3 { margin-top: -15; color: #fff; font-family: 'franklin gothic', 'arial', 'sans serif'; font-weight: lighter; font-size: 20px; } div.whatwedo p { margin: 0 auto; color: #ffffff; font-family: 'franklin gothic', 'arial', 'sans serif'; font-weight: lighter; font-size: 15px; max-width: 500px; } div.whatwedo hr { border-bottom: 1px solid #fff; margin-bottom: 50px; width: 100px; } div.whatwedo div.container { vertical-align: top; display: inline-block; text-align: center; } div.whatwedo div.container img { margin: 50px 25px 0 25px; width: 231px; height: 231px; } div.whatwedo div.container p { margin-top: 20px; display: block; max-width: 210px; }
as said, float: none !important;
, initial !important;
other rules. if want write code, asigning float body, html , on doesn't idea. float breaks usual behaviour of elements , can lead unexpected results. add clases like:
.f-left{ float:left; }
only elements want float.
Comments
Post a Comment