Jump to content

Adjustable Auto Image


Felipe Ramalho

Recommended Posts

Percentages.

 

EDIT:

 

With you height and width properties

Edited by niche
  • Like 1
Link to comment
Share on other sites

Percentages.

 

EDIT:

 

With you height and width properties

 

Example

 

image.gif

 

Okay got% using leave Picture Adjustable Computer screen.
But I could not do it aligar in the center!
Need an Image Aligned Center - TOP
I tried to use that background-position: center;
Unlike my Language and Send Me Your Source to Comment if possible.
Alignment Img must be Made in html or css?
Link to comment
Share on other sites

Please post your code using the code tags. Based on your example, I'd use the padding property.

Link to comment
Share on other sites

Please post your code using the code tags. Based on your example, I'd use the padding property.

 

Html

<html><head>	<link rel="stylesheet" href="style.css"></head><body><div class="img"> <img src="logo.png" width="100%" height="100%"></div>

Css

div.img{margin:2px;border:1px solid #0000ff;height:20%;width:10%;float:left;text-align:center;}
So I'm doing it is centralized, easier method would?
Making this CSS Way
div
{
margin: 2px;
border: 1px solid # 0000ff;
height: 20%;
width: 10%;
float: left;
text-align: center;
}
This was not to be centered also because of the content DIV in html css has this as herença. So the img inside the DIV html should inherit Style
Send me the Code the way you use.
Link to comment
Share on other sites

<!DOCTYPE html><html><head><title>Felipe</title><style>img{width: 75%;}div.img{text-align: center;}</style></head><body><div class="img"> <img src="logo.png" alt="logo"/></div></body></html>
Edited by davej
  • Like 1
Link to comment
Share on other sites

I am not in the habit of using percentages. They seem to often work over a certain small range and then the rounding errors cause them to fail. Perhaps someone here can explain how to do this in the best possible way.

<!DOCTYPE html><html><head><title>Percent Felipe</title><style>div#header{height: 60px;text-align: center;background-color: #6666ee;border: 1px solid black;margin: 1px 0;width: 100%;}div#envelope{border: 1px solid black;float: left;width: 100%;}div#menu{width: 15%; /* troublesome */height: 600px;background-color: green;float: left;border: 1px solid black;margin: 1px;}div#main{border: 1px solid black;float: right;margin: 1px auto;width: 83%; /* troublesome */height: 600px;background-color: #8888ff;text-align: center;}img{width: 95%;margin: 50px auto;border:8px solid blue;}footer{height: 40px;text-align: center;background-color: #6666ee;border: 1px solid black;margin: 1px 0;width: 100%;float: none;clear: both;}</style></head><body><div id="header"><h3>This is the header</h3></div><div id="envelope"><div id="menu"></div><div id="main"> <img src="http://i.imgur.com/GbguM.png" alt="logo"/></div></div><footer><h3>This is the footer</h3></footer></body></html>
Edited by davej
Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...