Reputation: 559
I was wondering how could you set height of an image to the neighboring elements height. So, essentially I want to have it like this:
[div] [img]
Other than javascript I can't see a way how can I do this. So, instead of using js can I just use CSS?
Thank you
Code so far(nothing special):
<div style="text-align:right;">
<label for="file-upload">Choose file</label>
<img><!-- Updates dynamically using js-->
<input id="file-upload" type="file" name="photo"/>
<input type="submit" value="Upload Image" name="submit" />
</div>
Upvotes: 0
Views: 86
Reputation: 2110
In order to style neighboring elements in CSS you can use adjacent selector(plus sign). As in following:
label + img{height:300px}
That will target img in your code "after" any label.
Upvotes: 1