photos in a responsive web page not...

User 138688 Photo


Registered User
242 posts

This is what I have added to the default css sheet. I have placed it at the end of the sheet just inside the closing bracket. I just don't understand why the sample I copied from the website Paintbrush sent me didn't work.

}

.gallery dt { font-weight: bold; }

.gallery dt img
{
border: 1px solid #000;
width: 1px;
height: 1px;
display: inline;
}

.gallery dd
{
margin: 0;
padding: 0;
display: inline;
}
h1.photo1 {
width: 25%;
height: auto;
}
}
Tom Mooney


User 271657 Photo


Ambassador
3,816 posts

You have each image/title set in its own <dl>. Change it to one list:

<dl class="gallery">
<dt><img src="images/gord.jpg" alt="company name" ></dt>
<dd>ceo<br>harry</dd>
<dt><img src="images/rob.jpg" alt="company name" ></dt>
<dd>pres<br>bob</dd>
</dl>


Then you can set your CSS for your <dl> in general; font, color, margins...
- Set some specs for the images if needed: .dt img { width, etc } (you don't need to add anything to the HTML since the image is within the <dt> tags).
- dt, dd { display: inline; }

I love deadlines. I like the whooshing sound they make as they fly by. (Douglas Adams)
https://www.callendales.com
User 271657 Photo


Ambassador
3,816 posts

OK... Never mind the above. I just had a play with the code on the def. list site.
He's putting each item within its own 'dl class="gallery" ' to get these to display inline.
I just tried it and it worked like a charm.
Much easier than what I've concocted in the past! :lol:


dl.gallery {
border: 1px solid #000;
background-color: #ddd;
width: 102px;
text-align: center;
padding: 10px;
float: left;
margin-right: 1em;
}

.gallery dt { font-weight: bold; }

.gallery dt img
{
border: 1px solid #000;
width: 45px;
height: 45px;
}

.gallery dd
{
margin: 0;
padding: 0;
}


-----------------------------------------------

<dl class="gallery">
<dt><img src="images/apple.png" width="38" height="40" alt="" ></dt>
<dt>Apple</dt>
<dd>Description here</dd>
</dl>
<dl class="gallery">
<dt><img src="images/gift-small.png" width="43" height="40" alt="" ></dt>
<dt>Gift Box</dt>
<dd>Description here</dd>
</dl>
<dl class="gallery">
<dt><img src="images/comfy-chair.png" width="46" height="42" alt="" ></dt>
<dt>Big Chair</dt>
<dd>Description here</dd>
</dl>


Try getting rid of this:
h1.photo1 {
width: 25%;
height: auto;
}
(Since there's already css for the image above.)
I love deadlines. I like the whooshing sound they make as they fly by. (Douglas Adams)
https://www.callendales.com

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.