html - H3 doesn't display with CSS inline, but with external CSS-File -
i copied/wrote simple "image grid" in simple html file. first used external css file. worked fine. since can't load external css file @ work page (only access html code between <body>
) tried copy attributes style inline. then, h3 disappears. can me?
the working external css file:
<script> .image-zoom-container { list-style: none; font-size: 0px; } .zoom-container { position: relative; overflow: hidden; display: inline-block; width: 33.33%; font-size: 16px; font-size: 1rem; border: 1px solid #fff; vertical-align: top; box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; } .zoom-container img { display: block; width: 100%; height: auto; } .zoom-container .zoom-caption { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 10; } .zoom-container .zoom-caption h3 { display: block; text-align: center; font-family: 'source sans pro', sans-serif; font-size: 1.5em; font-weight: 900; letter-spacing: -1px; text-transform: uppercase; color: #fff; margin: 23% 0 0; padding: 10px 0; } </script>
with html:
<html> <head> <link rel="stylesheet" href="main.css"> </head> <div class="image-zoom-container"> <div class="zoom-container"> <span style="zoom-caption"> <h3>text</h3> </span> <img src="test.png" /> </div> </div>
but inline, doesn't work:
<html> <head> </head> <body> <div style="list-style: none; font-size: 0px;"> <div style="position: relative; overflow: hidden; display: inline-block; width: 33.33%; border: 1px solid #fff; vertical-align: top; box-sizing: border-box; -moz-box-sizing: border-box;"> <a href="#"> <span style="position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 10;"> <h3 style="display: block; text-align: center; font-size: 1.5em;">costa rica</h3> </span> <img style="display: block; width: 100%; height: auto;" src="selection_009.png" /> </a> </div> </div> </body> </html>
the inline styles in bottom block not same styles in css file.
instance, div used .zoom-container
not have font size specified. therefore inherits font size parent (being 0px
), making text within invisibly small. yes, h3
have font-size: 1.5em
, 1.5 × 0px still 0.
solution: copy all css .css file.
also, shouldn't put h3
in span
. validate html before publishing!
Comments
Post a Comment