Thanks for all of your help on my previous question! However, I noticed a small issue- It's not too important, I just wanted to know if there's a way to fix it. As the browser window gets smaller, the images start to overlap. I'd like the images to stop when they're 5px away from each other.
Could someone look over my code and make sure I'm not doing anything wrong with my HTML/CSS?
The HTML is this:
<div class="content">
<div class="listingThumbLine">
<div class="modelListing left">
<a href="modelOne.html">
<img src="modelOne.jpg" alt="Model One" class="modelThumb" id="modelOneThumb">
</a>
<br />
<span class="productThumbName">Model Name</span>
</div>
<div class="modelListing right">
<a href="modelTwo.html">
<img src="modelTwo.jpg" alt="Model Two" class="modelThumb" id="modelTwoThumb">
</a>
<br />
<span class="productThumbName">Model Name</span>
</div>
<div class="modelListing center">
<a href="modelThree.html">
<img src="modelThree.jpg" alt="Model Three" class="modelThumb" id="modelThreeThumb">
</a>
<br />
<span class="productThumbName">Model Name</span>
</div>
</div>
</div>
The CSS is this:
body{
background-image:url('bg.jpg');
background-repeat:repeat-x;
font-family: Arial;
color:#B5B5B5;
text-align:center;
}
.content{
font-size:1.25em;
margin:10px 100px;
}
img.modelThumb{
width:225px;
height:225px;
}
.left{
float:left;
position:relative;
}
.right{
float:left;
position:relative;
}
.center{
float:left;
margin: 0 auto;
}
.modelListing{
width: 33%;
text-align: center;
}
Related
I'm trying to get 3 divs to align horizontally in my footer. I've tried a bunch of different solutions and have been able to get them very close, but they're just not perfectly aligned.
As of right now, the "biofreeze" element is a bit too high up and the "rocktape" element slightly overlaps the "graston" element. The "graston" element is pretty much exactly where I want it, though.
Playing around with the margins also doesn't seem to work too well.
Here's the code:
#sponsors {
width: 100% vertical-align: top !important;
}
#biofreeze {
float: left;
width: 33%;
}
#graston {
float: left;
width: 33%;
}
#rocktape {
float: left;
width: 33%;
}
<div id="sponsors">
<div id="biofreeze">
<a href="http://www.biofreeze.com/">
<img src="http://placehold.it/200x200" />
</a>
</div>
<div id="graston">
<a href="http://www.grastontechnique.com/home">
<img src="http://placehold.it/200x200" />
</a>
</div>
<div id="rocktape">
<a href="http://www.rocktape.com/">
<img src="http://placehold.it/200x200" />
</a>
</div>
</div>
You might consider using inline-block in this case for different heights. Also, vertical-align won't work for floated elements. Plus, there's no ; before vertical-align, so it won't even affect.
#biofreeze,
#graston,
#rocktape {
display: inline-block;
width: 33%;
vertical-align: top;
}
<div id="sponsors">
<div id="biofreeze">
<a href="http://www.biofreeze.com/">
<img src="http://placehold.it/200x200" />
</a>
</div><div id="graston">
<a href="http://www.grastontechnique.com/home">
<img src="http://placehold.it/200x275" />
</a>
</div><div id="rocktape">
<a href="http://www.rocktape.com/">
<img src="http://placehold.it/200x100" />
</a>
</div>
</div>
Or if you want all these to be aligned middle, you can use vertical-align: middle instead:
#biofreeze,
#graston,
#rocktape {
display: inline-block;
width: 33%;
vertical-align: middle;
}
<div id="sponsors">
<div id="biofreeze">
<a href="http://www.biofreeze.com/">
<img src="http://placehold.it/200x200" />
</a>
</div><div id="graston">
<a href="http://www.grastontechnique.com/home">
<img src="http://placehold.it/200x275" />
</a>
</div><div id="rocktape">
<a href="http://www.rocktape.com/">
<img src="http://placehold.it/200x100" />
</a>
</div>
</div>
100% working code
#sponsors {
width: 100%;
vertical-align: top !important;
overflow:hidden;
border:2px solid grey;
}
#biofreeze{
height:250px;
background-color:#07c;
}
#graston{
height:300px;
background-color:#cc5600;
}
#rocktape{
height:100px;
background-color:#45ba5b;
}
#biofreeze,#graston,#rocktape {
display:inline-block;
float: left;
width: 33%;
}
<div id="sponsors">
<div id="biofreeze">
Height:250px;
</div>
<div id="graston">
Height:300px;
</div>
<div id="rocktape">
Height:100px;
</div>
</div>
I'm trying to set the same hight for three columns. I've been looking around internet and I tried several options, but any of them seems to be working.
Here is the code:
html
<div class="container">
<div id="firstBlockGroup" class="col-md-24">
<div class="columnLayout col-md-8 col-sm-8 col-xs-24">
<img class="imageOfColumn" src="images/leftImg.png" alt=""/>
<div class="descriptionPic">
<span class="titleLabelPic">BORDEAUX 2014</span>
<span class="descLabelPic">Read our honest review of this interesting most recent vintage</span>
<span class="moreLabelPic">If it's a lemon, we call it a lemon >>></span>
</div>
</div>
<div class="columnLayout col-md-8 col-sm-8 col-xs-24">
<img class="imageOfColumn" src="images/middleImg.png" alt=""/>
<div class="descriptionPic">
<span class="descLabelPic">Decorum Vintners' Producer of the Month</span>
<span class="descLabelPic">June 2015</span>
<span class="moreLabelPic">Domaine ETIENNE SAUZET >>></span>
</div>
</div>
<div class="columnLayout col-md-8 col-sm-8 col-xs-24">
<img class="imageOfColumn" src="images/rightImg.png" alt=""/>
<div class="descriptionPic">
<span class="descLabelPic">Discover incredible wines from Queen Victoria's favourite region in Germany</span>
<span class="moreLabelPic">Mosel Superstars >>></span>
</div>
</div>
</div>
</div>
css
.columnLayout {
padding: 0px;
margin-right: 20px;
width: 32.4%;
height:100%;
}
.columnLayout img{
width:100%;
}
.columnsContainer{
padding-bottom:50px;
}
#firstBlockGroup{
margin-bottom:50px;
overflow:hidden;
padding:0;
display:inline;
}
div.columnLayout:last-child{
margin-right: 0 !important;
}
.descriptionPic{
background-color:#fff;
padding:10px;
}
.descriptionPic span{
display:block;
}
.titleLabelPic{
text-transform: capitalize;
}
.descLabelPic{
color:#78777d;
}
.moreLabelPic{
color:#58575f;
font-weight:400;
}
.imageOfColumn{
width:100%;
height:220px;
}
I've been trying to put it on JSfiddle but they appear displayed in block, no column next each other....
Can someone give me a hand? I don't know what I'm doing wrong...
Cheers!!!
in your .columnLayoutclass add a min height property e.g.min-height:200px; so that all the container should have a minimum height and if your content within these blocks is more than they will adapt to the new height.
Try display: table on your container div, and display: table-cell on the columns.
I have the following code :
#pageMainContent {
margin-top: 20px;
margin-left: 40px;
width: 800px;
font-size: 16px;
line-height: 130%;
text-align: justify;
}
.pageMainContentLeft {
float: left;
width: 100px;
}
.pageMainContentRight {
width: 600px;
float: right;
margin-right: 90px;
text-align: justify;
}
.pageMainContentRight a{
color:#000000;
and code :
<div id="pageMainContent">
<div class="pageMainContentLeft" style="width:100px; height:200px; padding-top:50px"><img alt="" src="image1.png" /></div>
<div class="pageMainContentRight" style="font-size:16px; line-height:130%;"><p><span style="font-size:24px; font-weight:600; font-family:Arial;">Text </span></p>More Text.</div><br />
<div style="clear:both"></div>
<div class="pageMainContentLeft" style="width:100px; height:160px; padding-top:40px"><img alt="" src="image2.png" /></div>
<div class="pageMainContentRight" style="font-size:16px; line-height:130%;"><p><span style="font-size:24px; font-weight:600; font-family:Arial;">Text </span></p>More Text.</div><br />
<div style="clear:both"></div><br />
<div class="pageMainContentLeft" style="width:100px; height:150px; padding-top:30px"><img alt="" src="image3.png" /></div>
<div class="pageMainContentRight" style="font-size:16px; line-height:130%; text-align:justify;"><p><span style="font-size:24px; font-weight:600; font-family:Arial;">Text </span></p>More Text.</div><br />
<div style="clear:both"></div>
<div class="pageMainContentLeft" style="width:100px; height:160px; padding-top:34px"><img alt="" src="image4.png" /></div>
<div class="pageMainContentRight" style="font-size:16px; line-height:130%; margin-top:-20px"><p><span style="font-size:24px; font-weight:600; font-family:Arial;">Text </span></p>Text </span></p>More Text.</div><br />
</div>
Inside the div pageMainContent I want to display 4 pictures with text underneath (in the shape of a box). What is the correct layout in each of the four divs ?
(its left picture then text underneath then horiztonal to that picture its right picture with text underneath - drop a few spaces and repeat for 2 more boxes)
P-----------------------P
T-----------------------T
P-----------------------P
T-----------------------T
P - Picture
T - Text
<div class="pageMainContentLeft" style="width:100px; height:200px; padding-top:50px">
<img alt="" src="image1.png" />
<div style="width:100px;"><p>Text Here</p></div>
</div>
Also do something similar for the right div. I however recommend you restructure your code to make things easier for you.
<div class="sectionContainer">
<div class="entry" >
<div class="pageMainContentLeft" style="width:100px; height:200px; padding-top:50px">
<img alt="" src="img/inspire/1.jpg" />
</div>
<div class="pageMainContentRight" style="font-size:16px; line-height:130%;">
<p><span style="font-size:24px; font-weight:600; font-family:Arial;">Text </span>
</p>More Text.
</div>
</div>
<div class="entry">
<div class="pageMainContentLeft" style="width:100px; height:200px; padding-top:50px">
<img alt="" src="img/inspire/1.jpg" />
</div>
<div class="pageMainContentRight" style="font-size:16px; line-height:130%;">
<p><span style="font-size:24px; font-weight:600; font-family:Arial;">Text </span>
</p>More Text.
</div>
</div>
</div>
If you divide you code into sections, you will have more control of the code.
In my code, divs with sectionContainer class will display as rows because you will not define any floating for it in you css. So by definition, div elements are block elements and they will show as blocks, that is one on top of another.
For class entry, define a float to the left in your css and they will all be aligned from the left.
Make sure the width of .sectionContainer class is wide enough to accommodate two .entry items.
The main issue you had was that you mixed up which things should be left content and right content. I made a very basic method of making a box. You can format it as you wish
<div class="pageMainContentLeft">
<img alt="image1" src="image1.png" />
</div>
<div class="pageMainContentRight">
<img alt="Image2" src="image2.png" />
</div>
<div style="clear:both"></div><br />
<div class="pageMainContentLeft"><p>text</div>
<div class="pageMainContentRight"><p>text</p></div>
<div style="clear:both"></div><br />
<div class="pageMainContentLeft">
<img alt="image3" src="image3.png" />
</div>
<div class="pageMainContentRight">
<img alt="Image4" src="image4.png" />
</div>
<div style="clear:both"></div><br />
<div class="pageMainContentLeft"><p>text</div>
<div class="pageMainContentRight"><p>text</p></div>
<style>
#pageMainContent {
margin-top: 20px;
margin-left: 40px;
width: 800px;
font-size: 16px;
line-height: 130%;
text-align: justify;
}
.pageMainContentLeft {
float: left;
width: 200px;
}
.pageMainContentRight {
width: 200px;
float: right;
}
</style>
I have a title with html code:
<div id="site-title">
<a rel="home" > book Journey</a>
</div>
No i want to insert a small pic infront of this book journey, how can i do it.
You can use <span> inline elements to work with text along with images
HTML
<div id="site-title">
<a rel="home" ><img src="imageurl"/><span>book Journey</span></a>
</div>
CSS
img,span{
vertical-align:middle;
}
Fiddle
Why don't you use an Image tag for the link.
<img src="/path_to_img"/><span>book journey</span>
Try this:
<div id="site-title">
<a rel="home" >
<img style="float:left;" src="path-of-your-image/image.jpg" />
book Journey
</a>
</div>
Here is the answer you asked for ,
http://jsfiddle.net/Manjuboyz/vJS4m/133/
<div id="first">
<div id="text"> Book Journey
</div>
<div id="img"><img src="~/Images/doctor-landing.png" style="height: 100%; width: 100%;" </div>
</div>
CSS for above
#first{
height:35px;
width:150px;
border:1px solid brown;
}
#text{
height:30px;
width:100px;
border:1px solid black;
float:left;
}
#img{
height:30px;
width:30px;
margin-left:110px;
border:1px solid teal;
}
NOTE:
Change the image to left or right as you needed
UPDATE
Responsive Screen
So I am creating my own website for the first time and after a bunch of problems, I've ran into one I am unsure of how to fix.
ngkevin-art.com/about.html
This is how it looks like in Dreamweaver and how I want it to look:
http://i.imgur.com/wlOIR.jpg
But when I go into Live View, or see it online, it falls apart. Any help would be appreciated.
CSS:
#charset "utf-8";
/* CSS Document */
/* General HTML Tag Rules */
body {
width:auto;
height:auto;
background-image:url(images/bg_demo2.png);
background-color:#2d2d2d;
background-repeat:no-repeat;
background-position:center;
margin-top:30px;
}
#font-face {
font-family: Harabara;
src: url(Harabara.ttf);
font-weight:200;
}
h1 {
font-family: Harabara, Helvetica, Arial, sans-serif;
font-size:150%;
color:#CECEBC;
}
h2 {
font-family: Harabara, Helvetica, Arial, sans-serif;
font-size:100%;
color:#CECEBC;
}
.text {
margin-left:75px;
width:auto;
float:left;
}
#text2 {
width:408px;
text-align:center;
}
.text3 {
margin-left:25px;
width:auto;
float:left;
}
#container {
width:1280px;
height:960px;
margin-left:auto;
margin-right:auto;
}
#wrapContact {
width: 520px;
height: 100px;
margin-left:735px;
margin-top: 10px;
clear: both;
}
#linked {
float:left;
margin-top:35px;
width: 175px;
}
#facebook {
float:left;
width: 200px;
margin-left:32px;
margin-top:25px;
}
#email {
float:left;
width:75px;
margin-left:35px;
margin-top:20px;
}
#wrapNav {
width: 475px;
margin-left:750px;
margin-top:60px;
}
#demo {
width: 500px;
text-align:center;
margin-top: 70px;
margin-left:auto;
margin-right:auto;
}
#flatbook {
width:250px;
margin-left:auto;
margin-right:auto;
margin-top:20px;
}
#wrapAbout {
margin-left:auto;
margin-right:auto;
margin-top:75px;
width: 1100px;
height:auto;
}
#picture {
width:408px;
margin-top:100px;
float:left;
}
HTML:
<body>
<div id="container">
<div id="wrapContact">
<div id="linked">
<a href="http://www.linkedin.com/pub/kevin-ng/25/558/75b">
<img src="images/logo_linked_large.png" width="auto" height="auto" border="0" alt="linkedin_logo" /> </a>
</div>
<div id="facebook">
<a href="http://www.facebook.com/profile.php?id=1309131548">
<img src="images/logo_fb_large.png" width="auto" height="auto" border="0" alt="facebook_logo" /> </a>
</div>
<div id="email">
<a href="mailto: ngkevin.3dartist#gmail.com">
<img src="images/gmail.png" width="auto" height="auto" border="0" alt="email_icon" /> </a>
</div>
</div> <!-- End "wrapContact"> -->
<div id="wrapNav">
<a href="index.html">
<img src="images/bg_tab_main.png" width="auto" height="auto" border="0" alt="Main" /> </a>
<a href="demo.html">
<img src="images/bg_tab_demo.png" width="auto" height="auto" border="0" alt="Demo" /> </a>
<a href="about.html">
<img src="images/bg_tab_about.png" width="auto" height="auto" border="0" alt="About" /> </a>
</div>
<!-- End "wrapNav"> -->
<div id="wrapAbout">
<div id="picture">
<img src="images/picture.jpg" width="auto" height="auto" alt="picture" />
<div id="text2">
<h2> Me in the middle left, my buddies, Jordan Gabriel on the left and Edmund Zhu on the right,
and finally, Epic Games VIP, Cliff Bleszinski! Taken at GDC 2010. </h2>
</div>
</div>
<div class="text">
<h1> Resume: <br/>
<br/> Email: <br/> <br/>
<br/> About Me:</h1>
</div>
<div class="text3">
<h1> Click Here
<br/> <br/> ngkevin.3dartist#gmail.com <br/>
<br/> <br/> <font size="4">
My desire to be in the game development industry is to work with other individuals that take pride in creating a game,
something that can be enjoyed by a multitude of people. There is nothing I would like better than to lend my talents and
artistic skills for that purpose. <br/> <br/>
I believe the key to creating memorable game art, whether it be characters or environments, is the story.
Just like reading a good book or watching a thrilling movie, I loved to be immersed in the world of the game. As a result,
I had an affinity to Role-Playing Games. Classic games of my generation such as Chrono Trigger, Final Fantasy, and Zelda
showed me a world of endless imagination. <br/> <br/>
The characters which are the focal point of the story, their goals and motivations, their trials and tribulations,
their victories and defeats... These are the things I think about constantly when I look at them.
A character without depth doesn't exist, but if they do, I can only imagine how boring that would be. </font></h1>
</div>
</div>
</div><!-- End "container" -->
</body>
Try giving your .text3 class a fixed width. 450px looks about right.