css - Making a border around text with background image without affecting image -
i have background image h1 , paragraph tag on top. wish create border around h1 tag without affecting padding or margin of header. when create border, surrounds text and top padding. there way apply border around text only?
the complete code on jsfiddle here.
the css code here:
header { background-image: url("https://images.pexels.com/photos/8263/pexels- photo.jpg?w=940&h=650&auto=compress&cs=tinysrgb"); height: 500px; padding: 0; margin: 0; background-attachment: fixed; background-size: cover; text-transform: capitalize; } h1 { color: black; text-align: center; display: block; font-size: 50px; padding-top: 180px; margin: 0; }
below code used effect. can have play padding , margins h1 space out if want.
body{ background-color: #404040; } header{ background-image: url("https://images.pexels.com/photos/8263/pexels-photo.jpg?w=940&h=650&auto=compress&cs=tinysrgb"); height: 500px; padding: 0; margin: 0; background-attachment: fixed; background-size: cover; text-transform: capitalize; padding-top: 180px; text-align:center; } h1{ color: white; text-align: center; font-size: 50px; padding:0px; border:1px solid #000000; display:inline-block; margin:0 auto; line-height:40px; } p{ color: white; text-align: center; font-size: 30px; }
<body> <header> <h1>guitar covers</h1> <p>this new page uploading guitar covers share world</p> </header> </body>
Comments
Post a Comment