CSS HTML Image with Text Overlay & Button -
i'm newbie stuff & i'm sure it's simple enough fix, i'm struggling find way format text on image css button - need code responsive works on mobile devices also.
any advice hugely appreciated.
thanks all,
johnny_p
here's css:
/* set custom square call action button */ #ctasquare-button-container { text-align: center !important; } #ctasquare-button { text-align: center !important; border: solid #000000 2px; border-radius: 2px; -moz-border-radius: 2px; -webkit-box-shadow: 0 0px 0 0 #b13f21; -moz-box-shadow: 0 0px 0 0 #b13f21; box-shadow: 0 0px 0 0 #b13f21; position: absolute; margin: 0 0 0 -115px; top:30; -webkit-transition: .1s background-color linear; -moz-transition: .1s background-color linear; -o-transition: .1s background-color linear; transition: .1s background-color linear; padding: 21px 35px; color: #fff; border-color: #fff; font-family: futura-pt; font-size: 15px; text-transform: uppercase; letter-spacing: 2px; font-weight: 500; font-style: normal; cursor: pointer; } #ctasquare-button:hover { background-color: #fff; border-radius: 2px; -webkit-box-shadow: 0 0px 0 0 #b13f21; -moz-box-shadow: 0 0px 0 0 #b13f21; box-shadow: 0 0px 0 0 #b13f21; position: absolute; -webkit-transition: .1s background-color linear; -moz-transition: .1s background-color linear; -o-transition: .1s background-color linear; transition: .1s background-color linear; color: black; } /* end custom sqaure call action button */ /* overlay text on image properties */ .sidebyside { position: relative; width:100%; text-align:center; /* ie 6 */ } textoverlay { position: absolute; top: 0px; text-align: center; right: 50px; left:50px; width: 100%; padding: 0px 0px 0px 0px; margin: 30px 0px 0px 0px; } h2.titleblock { font-color: #fff; font-size: 62px; text-align: center; position: relative; font-weight: normal; margin: 30px 40px; } /* end overlay text on image properties */
and here's html:
<div> <div class="sidebyside"> <img src="http://static1.squarespace.com/static/548c3773e4b0c5db6dc87107/t/559d66a4e4b0f2834cbd26d0/1436378788290/surface-sq-left-orange.png" width="480"; height="480"alt="ict in education" /> <textoverlay> <h2 class="titleblock"><span style="color:white">my awesome title</span></h2> <h2> <font color="white">this subtitle goes. quick brown fox jumps on lazy dog</font> </h2> <div class="ctasquare-button-container"> <a href="/xxx" id="ctasquare-button">learn more </a> <br><br> </div> </textoverlay> </div> </div>
for start try this:
/* set custom square call action button */ #ctasquare-button-container { text-align: center !important; } #ctasquare-button { text-align: center !important; border: solid #000000 2px; border-radius: 2px; -moz-border-radius: 2px; -webkit-box-shadow: 0 0px 0 0 #b13f21; -moz-box-shadow: 0 0px 0 0 #b13f21; box-shadow: 0 0px 0 0 #b13f21; position: absolute; margin: 0 0 0 -115px; top:30; -webkit-transition: .1s background-color linear; -moz-transition: .1s background-color linear; -o-transition: .1s background-color linear; transition: .1s background-color linear; padding: 21px 35px; color: #fff; border-color: #fff; font-family: futura-pt; font-size: 15px; text-transform: uppercase; letter-spacing: 2px; font-weight: 500; font-style: normal; cursor: pointer; } #ctasquare-button:hover { background-color: #fff; border-radius: 2px; -webkit-box-shadow: 0 0px 0 0 #b13f21; -moz-box-shadow: 0 0px 0 0 #b13f21; box-shadow: 0 0px 0 0 #b13f21; position: absolute; -webkit-transition: .1s background-color linear; -moz-transition: .1s background-color linear; -o-transition: .1s background-color linear; transition: .1s background-color linear; color: black; } /* end custom sqaure call action button */ /* overlay text on image properties */ .sidebyside { position: relative; width:100%; text-align:center; /* ie 6 */ } .sidebyside img{ width: 100%; max-height: 100%; height: auto; } textoverlay { position: absolute; text-align: center; right: 0; left:0; bottom:0; top:0; padding: 0px 0px 0px 0px; margin: auto; } h2.titleblock { font-color: #fff; font-size: 62px; text-align: center; position: relative; font-weight: normal; margin: 30px 40px; } /* end overlay text on image properties */
<div> <div class="sidebyside"> <img src="http://static1.squarespace.com/static/548c3773e4b0c5db6dc87107/t/559d66a4e4b0f2834cbd26d0/1436378788290/surface-sq-left-orange.png" width="480"; height="480"alt="ict in education" /> <textoverlay> <h2 class="titleblock"><span style="color:white">my awesome title</span></h2> <h2> <font color="white">this subtitle goes. quick brown fox jumps on lazy dog</font> </h2> <div class="ctasquare-button-container"> <a href="/xxx" id="ctasquare-button">learn more </a> <br><br> </div> </textoverlay> </div> </div>
to display sites correctly on other divices need implement media queries example:
@media screen , (max-width: 300px) { .sidebyside img{ width: auto; height: 100%; } }
Comments
Post a Comment