Forum Moderators: open
1)There are a dozen or so thumbnails on the pages, but I have included the dimensions in the HTML. The other images are CSS background-images.
2)I read the thread from the link. I'm not using @import; I'm linking to an external stylesheet. Also, I do have a little date script on the page.
Still looking for a fix.
Being a newbie CSSer, here is how I did one iteration:
#property {
width: 450px;
margin-left: auto;
margin-right: auto;
clear: both;
border-top: 1px solid #ccc;
}
#left {
width: 130px;
float: left;
padding-top: 3px;
margin: 30px 20px 30px 0;
}
#right {
width: 300px;
float: right;
margin: 30px 0 0 0;
}
<div id="property">
<div id="left">
<a href="100_photos_retail.htm"><img border="0" src="thumbs/100_001_th.jpg" alt=" " width="108" height="72"></a><br>
<p class="thumbtext">adress under thumb</p>
</div>
<div id="right">
<p class="description"><a class="strong" href="100_photos_retail.htm">BUILDING 100</a><br><span class="name">Building Name</span></p>
<p class="description">brief description</p>
<p class="description">rent</p>
<p class="description">when available</p>
<p class="description"><a href="100_photos_retail.htm">[Details and additional photos]</a></p>
</div>
</div>
Very nice, but I need a dozen or so properties on each page and I'm allowed an ID only once per page. That doesn't seem to make sense, since this works so well. Certainly I don't want IDs named property1, property2, etc.(?)
Anyway, I tried using classes, but then I'm not allowed a paragraph inside a span (which also works fine).
So how do I do this?
Certainly I don't want IDs named property1, property2, etc.(?)
Why not? You can have as many IDs as your mark-up needs - they just need to each have a different name.
#property1 {rules}
#property2 {rules}
#apple {rules}
#kangaroo {rules}
...etc.
Also consider if you can use descendant selectors [w3.org] to help make things more concise:
#property p {rules}
This would set rules for the content of any <p> tag within the #property div -- that is, any <p> tag that is a descendant of an element given the id #property. Then you don't need a special class declaration for each paragraph.
Anyway, I tried using classes, but then I'm not allowed a paragraph inside a span
don't quite understand that - Why would that involve putting a <p> inside a span..?
the code above is just fine, just change ID's #property, #left, #right to CLASSES .property, .left, .right, you can reuse the property div as you have it set up in the example as many times as you like in one page.
Further you can then still target the the <p> (using descendant selector as mentioned) in exactly the same way.
For instance in the left div (your thumbnail text) you wouldn't necessarily need another class on the <p> there as you can target it
.property .left p {rules}
however in the right side if you want to format the name description, available, rent etc.. differently you might like to add classes in there.
Suzy
Site=123 pages
Tables=0
See anything else that looks like a newbie wrote it?
.right p {
margin-top: 0;
margin-bottom: .5em;
line-height: 120%;
text-indent: 0;
}
.left p {
margin-top: 5px;
margin-bottom: 0;
font-family: arial, geneva, helvetica, geneva, sans-serif;
text-align: center;
line-height: 120%;
text-indent: 0;
color: #000;
}
.property {
width: 450px;
margin-left: auto;
margin-right: auto;
clear: both;
border-top: 1px solid #ccc;
}
.left {
width: 130px;
float: left;
padding-top: 3px;
margin: 30px 20px 30px 0;
}
.right {
width: 300px;
float: right;
margin: 30px 0 0 0;
}
<div class="property">
<div class="left">
<a href="link"><img alt=" " width="108" height="72"></a><br>
<p>address</p>
</div>
<div class="right">
<p><a class="strong" href="link">building number</a><br><span class="name">building name</span></p>
<p>brief description</p>
<p>rent</p>
<p>when available</p>
<p><a href="link">[Details and additional photos]</a></p>
</div>
</div>