css border around multiple links/images [closed] - html

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have 4 images which are links, I want to create a border but instead of creating it around each image (which automatically CSS does) I want to create it around the 4 images as a whole.

Place the images in a div and then make the border on the div
something like this:
<style>
.image-div{
border:1px #000;
}
</style>
<div class="image-div">
<img src="">
<img src="">
<img src="">
<img src="">
</div>

Check this JSFiddle: http://jsfiddle.net/RXmb9/4/
Wrap your images in a span or a div and then apply the border.
CSS
.cool { border:1px solid red; }
img { width:50px; height:50px; }
.one { /* Apply specific borders for images if you want */ }
HTML
<div class="cool">
<img src="" class="one" />
<img src="" class="two" />
<img src="" class="three" />
<img src="" class="four" />
</div>

Related

How can I align 4 photos side by side, and their individual text under them? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am trying to create a basic online store type of layout. Just very basic beginners CSS and HTML
Here is how to do that using flex styling. This is a great source for learning flex box (it's what I go to whenever I forget something).
#container{
display: flex; /*specifies that the items in the container should abide by flex styling*/
flex-direction: row; /*aligns the items in the container in a row*/
}
.imgContainer{
text-align: center; /*aligns the text in the center*/
padding: 2%; /*adds some extra white space around images*/
}
<!-- container element for all of the content.
It will line up the imgContainers in a row-->
<div id="container">
<!--imgContainers will contain each img and text combination -->
<div class="imgContainer">
<img src="https://www.nasa.gov/sites/default/files/styles/image_card_4x3_ratio/public/thumbnails/image/leisa_christmas_false_color.png?itok=Jxf0IlS4">
<p>This is an image</p>
</div>
<div class="imgContainer">
<img src="https://www.nasa.gov/sites/default/files/styles/image_card_4x3_ratio/public/thumbnails/image/leisa_christmas_false_color.png?itok=Jxf0IlS4">
<p>This is an image</p>
</div>
<div class="imgContainer">
<img src="https://www.nasa.gov/sites/default/files/styles/image_card_4x3_ratio/public/thumbnails/image/leisa_christmas_false_color.png?itok=Jxf0IlS4">
<p>This is an image</p>
</div>
<div class="imgContainer">
<img src="https://www.nasa.gov/sites/default/files/styles/image_card_4x3_ratio/public/thumbnails/image/leisa_christmas_false_color.png?itok=Jxf0IlS4">
<p>This is an image</p>
</div>
</div>

Centering a border that is smaller than its div [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have two divs that are col-xs-12 wide. There is no margin between them so they touch. I would like to add a border between them, like the image on the right (what I have currently is on the left).
I tried adding a 1 px height 11-wide column and centering it, but of course you can see a gap between the two rows on each side of the border.
Here's a jfiddle of the whole thing.
<div class="row top-buffer-10">
<div class="col-xs-12">
<div class="header-text">
<p style="font-size:130%"><b>%REGION%</b></p>
<p style="padding-bottom:15px;">(currently selected)</p>
</div>
</div>
</div>
<div class="row top-buffer-10">
<div class="col-xs-12">
<div class="img-with-text">
<img style="margin-top:5px;" src="img/gsd_list_contact.png" alt="itscl" />
<p style="font-size:90%;padding-left:0px;"><b>PHONE:</b> %LOCAL_PHONE%<br>
<b>TOLL FREE:</b> %TOLL_FREE%<br>
<b>LANGUAGE:</b> %LANGUAGE%
</p>
</div>
</div>
</div>
These are the two relevant divs to look out for.
There seems to be a little confusion, I want the border to be small than the div, as in, not just adding border top or border bottom.
See how the border doesn't quite reach the edges of the div. Thanks.
Here is a possible solution: https://jsfiddle.net/yjtrk00o/4/
EDIT:
add a css called division as shown below
In your HTML, add the line <hr class="division"/> just above the <div class="img-with-text">
CSS
.division{
border-top:1px solid #D3D3D3;
margin-top:0px;
margin-bottom:0px;
margin-left:10px;
margin-right:10px;
}
HTML
<div class="col-xs-12">
<hr class="division"/>
<div class="img-with-text">
I'm not sure if it's the desired effect you're after, but have you tried the following:
<div class="img-with-text" style="border-top: 1px solid black;">
Obviously you can fiddle with colour etc, or add that into the css class.
EDIT:
perhaps this then:
<div class="col-xs-12">
<div style="margin: 0 10px; display: block; height: 1px; background: #000;"></div>
<div class="img-with-text">
You can play with the margin to give you the offset from the edges you want. Probably not the most elegant solution, but seems to get the visual result you're after?

Custom thumbnail grid 3 columns? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I'm trying to get this to work, I found this.
Instead of 4 columns, I want to keep the same height for 3 columns. How can I do this?
This is how it looks on my frontend:
x http://imagizer.imageshack.us/v2/150x100q90/661/TS8KVU.png
And it should be at 100% of the screen side by side images.
like this? or you want the image fill the div?:
<div class="col-md-4 no-pad">
<img class="img-responsive" src="//placehold.it/1280x640/eee">
</div>
<div class="col-md-4 no-pad">
<img class="img-responsive" src="//placehold.it/1280x640/eee">
</div>
<div class="col-md-4 no-pad">
<img class="img-responsive" src="//placehold.it/1280x640/eee">
</div>
.no-pad{
padding-left:0px;
padding-right:0px;
height:381px;
}
.no-pad img{
width:100%;
height:100%;
}

responsive website with positioning of pictures [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to build a responsive website using javascript and css, but I don't understand how because I am a new programmer.
This is what the website should look like:
I have 9 pictures, and I want to display them as follows:
The header picture will always be 100% of the original browser width no matter if the window is resized.
The two logo pictures should always be in their positions even if the window is resized.
6 of the pictures have to be arranged in 2 lines in such a way that if the window is resized, you will always see all the pictures fit to the window width and height.
This is what I have done till now, but it doesn't give the result I wanted.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<style>
</style>
<div style="position:relative">
<img src="header.png" style="width:100%; position:absolute;">
<img src="logo1.png" style="left:30px; position:absolute;">
<img src="logo2.png" alt="" style="right:30px; position:absolute;">
</div>
<img src="1.jpg" style="position:relative; top:100px;">
<img src="2.jpg" style="position:relative; left:30px;">
<img src="3.jpg" style="position:relative; left:30px;">
<br>
<img src="4.jpg" style="position:relative; left:30px;">
<img src="5.jpg" style="position:relative; left:30px;">
<img src="6.jpg" style="position:relative;left:30px;">
</body>
</html>
How should I do this with Javascript code (using window.resize) and CSS positioning?
Thanks for your help.
Maybe try and check the frameworks:
Bootstrap,
Zurb Foundation
They both have explanations for deeper investigation.

Float 2 images to the right directly under each other, without pushing text down [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How can I float 2 images to the right and directly under each other, without pushing my text on the left down?
You probably don't want to float both images, as they'll be next to each other. What you want to do is put both images in a div and float the div. Something like...
HTML
<div id="container">
<div id="floated-imgs">
<img src="img1">
<img src="img2">
</div>
Text, content and whatnot.
</div>
CSS
#container { overflow: hidden; }
#floated-imgs { float: right; }
#floated-imgs img {display: block; }
Example: http://jsfiddle.net/PQChY/
Put both imgs inside a div and float that div.
<div id="img">
<img src="...">
<img src="...">
</div>
<p>Lorem ipsum dolor...</p>
And
#img {
float: right;
}
http://jsfiddle.net/buA2g/