asasass
February 11, 2017, 4:40pm
1
I need to put the image in the css part.
I test all my codes on here that’s why it’s all together below. I separated them in the jsfiddle.
http://htmledit.squarefree.com/
Code
<style type="text/css">
.outer {
max-width:466px; /*466 */
height: 88px; /*98*/
border: 5px solid #38761d;
background-color: #000;
margin: 0 auto; /* top+bottom left+right */
}
.hr3 {
color: #38761d;
font-style: normal;
font-size: 50px;
font-family: georgia;
text-align: center;
padding-bottom: 0px;
margin-top:2px;
margin-bottom: 0px;
}
.hr3 span {
display: block;
height: 5px;
background-color: #15c;
transform: rotate(-.9deg);
margin-top: 2px;
margin-left: 23px;
margin-right: 24px;
}
</style>
</head>
<body>
<div class="outer">
<p class="hr3">Text text text text<span></span></p>
<img src="https://i.imgur.com/BRJqTUw.png" style="border:solid 5px #38761d;vertical-align:middle;border-top:none; " width="466" /></a>
</div>
</body>
</html>
Do you mean you want to move the inline styles for the image into the style section, or that you want to insert the image as a background using CSS?
asasass
February 11, 2017, 4:49pm
3
I did this but the image isn’t centered.
img {
border:solid 5px #38761d;
border-top:none;
vertical-align:middle;
}
</style>
</head>
<body>
<div class="outer">
<p class="hr3">Text text text text<span></span></p>
<img src="https://i.imgur.com/BRJqTUw.png">
</div>
</body>
</html>
<style type="text/css">
.outer {
max-width:466px; /*466 */
height: 88px; /*98*/
border: 5px solid #38761d;
background-color: #000;
margin: 0 auto; /* top+bottom left+right */
}
.hr3 {
color: #38761d;
font-style: normal;
font-size: 50px;
font-family: georgia;
text-align: center;
padding-bottom: 0px;
margin-top:2px;
margin-bottom: 0px;
}
.hr3 span {
display: block;
height: 5px;
background-color: #15c;
transform: rotate(-.9deg);
margin-top: 2px;
margin-left: 23px;
margin-right: 24px;
}
img {
border:solid 5px #38761d;
border-top:none;
vertical-align:middle;
}
</style>
</head>
<body>
<div class="outer">
<p class="hr3">Text text text text<span></span></p>
<img src="https://i.imgur.com/BRJqTUw.png">
</div>
</body>
</html>
OK - that’s nearly right. If you want both the text in the paragraph .hr3 and the image to be centered, then remove text-align: center; from the rules for .h3r and add it instead to the rules for .outer.
Both the paragraph and the image are contained within .outer, so the text-align rulee will apply to them both.
Sorry - that tells me nothing.
asasass
February 11, 2017, 4:55pm
7
The image still ins’t centered
Have you changed the code as I suggested? I can’t tell what code you’re using from a picture.
asasass
February 11, 2017, 4:56pm
9
<style type="text/css">
.outer {
max-width:466px; /*466 */
height: 88px; /*98*/
border: 5px solid #38761d;
background-color: #000;
text-align: center;
margin: 0 auto; /* top+bottom left+right */
}
.hr3 {
color: #38761d;
font-style: normal;
font-size: 50px;
font-family: georgia;
padding-bottom: 0px;
margin-top:2px;
margin-bottom: 0px;
}
.hr3 span {
display: block;
height: 5px;
background-color: #15c;
transform: rotate(-.9deg);
margin-top: 2px;
margin-left: 23px;
margin-right: 24px;
}
img {
border:solid 5px #38761d;
border-top:none;
}
</style>
</head>
<body>
<div class="outer">
<p class="hr3">Text text text text<span></span></p>
<img src="https://i.imgur.com/BRJqTUw.png">
</div>
</body>
</html>
asasass
February 11, 2017, 4:58pm
11
What if I put a margin on the image?
asasass
February 11, 2017, 5:00pm
12
I don’t think its margin.
What if you just have patience for a moment, rather than just posting wild guesses and making your thread harder to follow? Give me a chance to look at it.
asasass
February 11, 2017, 5:09pm
14
Will this work?
Removing
margin-bottom: 0px;
from .hr3 {
or do I need that?
OK. You have height: 88px; on .outer, but that’s nonsense if you want it to also contain the image, so remove that rule.
Now remove the border:solid 5px #38761d; rule from the image. (The image is contained within .outer, which already has a border.
Add the width and height back into the HTML for the image. (Don’t add them as styles; add them as width="466", `height=“355”.)
asasass
February 11, 2017, 5:12pm
16
This centers is, but I don’t think negative margins are meant to center images, but maybe in this instance it does.
margin-left: -5px;
Once again, stop guessing. Now read my post above.
asasass
February 11, 2017, 5:15pm
18
I have to save the code first before you make me destroy it.
asasass
February 11, 2017, 5:16pm
19
I want the text to have it’s own border.
I want the image to have it’s own border.
asasass
February 11, 2017, 5:19pm
20
Like this:
<style type="text/css">
.outer {
max-width:466px; /*466 */
height: 88px; /*98*/
border: 5px solid #38761d;
background-color: #000;
text-align: center;
margin: 0 auto; /* top+bottom left+right */
}
.hr3 {
color: #38761d;
font-style: normal;
font-size: 50px;
font-family: georgia;
padding-bottom: 0px;
margin-top:2px;
margin-bottom: 0px;
}
.hr3 span {
display: block;
height: 5px;
background-color: #15c;
transform: rotate(-.9deg);
margin-top: 2px;
margin-left: 23px;
margin-right: 24px;
}
img {
border:solid 5px #38761d;
border-top:none;
margin-left: -5px;
margin-top:27;
}
</style>
</head>
<body>
<div class="outer">
<p class="hr3">Text text text text<span></span></p>
<img src="https://i.imgur.com/BRJqTUw.png" width="466" height="355">
</div>
</body>