My first image is throwing off everything. Go to my website and see what I mean. The three images on the right should be in the middle of the page and the text should be under the picture. What am i doing wrong?
<div id="img"><img src="images/15442_193554864778_3851953_n.jpg" width="245" height="306" alt="Me"/></div>
<div id="Lefttext"><p>Hello there. My name is Michael Pelvay and I am a Web specialist. A Web Specialist is between a Web Master and a Web Developer. A Web specialtist possesses the skills and knowledge to develop and implement dynamic Web sites, develop content-rich intranets and secure Web communications and web sites. </p></div>
<div id="portfolio"><img src="images/Portfolio.png" width="876" height="148" alt="portfolio" /></div>
<div id="resume"><img src="images/Resume.png" width="750" height="148" alt="Resume" /></div>
<div id="aboutme"><img src="images/About Me.png" width="624" height="148" alt="About Me" /></div>
html, body{
width:auto;
height:auto;
margin:0;
background-color:#121212;
}
#container{
margin:100px 50px 100px 300px;
min-width:500px;
max-width:1300px;
height:652px;
background-color:#26353c;
clear:both;
}
#img{
float:left;
width:245px;
margin:60px 0 0 60px;
}
#Lefttext{
color: #B5D5FB;
position:relative;
float: left;
width: 424px;
top:380px;
left:80px;
}
#portfolio{
float:right;
margin:100px -70px 0 0;
clear:right;
}
#resume{
float:right;
margin:15px -70px 0 0;
clear:right;
}
#aboutme{
float:right;
margin:15px -70px 0 0;
clear:right;
}
#name {
color:#FFF;
float:left;
margin:50px 0px 0px 320px;
}
#nav {
font-size:20px;
float:right;
margin:64px 250px 0px 0px;
}
#nav li{
display:inline;
margin-right:75px;
}
#nav a:link{
color:#C1CECC;
text-decoration:none;
}
#nav a:visited{
color:#C1CECC;
text-decoration:none;
}
#links{
font-size:24px;
}
#links a:link{
color:#C1CECC;
text-decoration:none;
}
You could give your #Lefttext a left: -245px, it wil put your text under the image
I tried this out in Chrome Dev tools, seems to work like you want:
#img{
float:left;
width:245px;
margin:60px 0 0 60px;
position: absolute;
}
Adding position: absolute; to the #img div takes it out of the flow of the document so everything else goes where you want.
If someone would like to explain why they gave a downvote to an answer that works and explains why it works, please feel free to add a comment below. :D
Mike - your challenge is a few different things:
If you float left, you need to clear: left anything you want to show below it.
If you have position relative, you should not specify top. top (as is left, right, bottom) are the appropriate properties for something positioned absolute or fixed.
Here's some suggested edits:
#Lefttext {
color: #B5D5FB;
float: left;
clear: left;
position: relative;
width: 424px;
margin-left: 80px;
}
Related
I'm still having a lot of trouble with this that it's even difficult to describe the problem now. The yellow text area should be right at the edge (righthand side edge) of the pink div and there should be 30px of margin in between this yellow area div and the other area on the left (contains the green and red areas).
The problem is fixed if I add 'float:right;' in 'home-featured-class-3', but this creates a new problem of shifting the yellow text area div to the top.
How can I make the yellow text div float right but also float vertically in the center? (without adjusting the height/width of anything)
HTML & CSS:
.home-featured-class-3{
width: 630px;
height:auto;
margin:0 0 0 30px;
display: inline-block;
vertical-align: middle;
background:#CF0;
}
.home-featured-class-4{
width:298px;
height:auto;
margin:0 0px 0 0;
border: 1px solid #211c20;
display: inline-block;
vertical-align: middle;
}
.home-featured-class-A{
width:960px;
height:auto;
background:#C3C;
vertical-align:middle;
}
.clear {
clear: both;
}
h6{
font-family:arial,verdana,helvetica,sans-serif;
font-size:18px;
color:#201c1f;
text-decoration:none;
text-transform:uppercase;
font-weight:100;
margin:0;
padding:10px;
background:#DB1D1D;
text-align:center;
border-top:1px solid #211c20;
}
h6 a:link{
color:#201c1f;
text-decoration:none;
}
h6 a:visited{
color:#201c1f;
text-decoration:none;
}
h6 a:hover{
color:#201c1f;
text-decoration:underline;
}
#home-featured-classes-wrap{
width:auto;
height:auto;
margin: 30px 0 0 0;
}
.home-featured-class:hover .products {
text-decoration: underline;
}
.home-featured-class-end{
width:298px;
height:auto;
margin:0 0 0 0;
border: 1px solid #211c20;
float:left;
}
.home-featured-class-end:hover .products {
text-decoration: underline;
}
<div id="home-featured-classes-wrap">
<div class="home-featured-class-A">
<div class="home-featured-class-4"><img name="RP-TEXT" src="http://upload.wikimedia.org/wikipedia/commons/d/de/Color-Green.JPG" width="298" height="148" alt="RP-TEXT" style="background-color: #3366FF" />
<h6 class="products">RP-TEXT</h6>
</div>
<div class="home-featured-class-3">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</div>
<div class="clear"></div>
</div>
</div>
This is your problem (described in CSS comments):
.home-featured-class-3{
width: 630px;
height:auto;
margin:0 0 0 30px; /* Here you set the margin to 30px on the left. */
display: inline-block;
vertical-align: middle;
background:#CF0;
margin: 0; /* Here you set it back to 0 again. Simply remove this line. */
}
Also you’ll have to remove the newlines (or comment them out) above <div class="home-featured-class-3">. The HTML engine creates an additional whitespace character because of this newline leaving you only about 27px of space instead of 30px. You’ll have to remove these newlines in order to be able to set a distance of 30px.
This is what your HTML needs to be:
<div id="home-featured-classes-wrap">
<div class="home-featured-class-A">
<div class="home-featured-class-4">
<img name="RP-TEXT" src="http://upload.wikimedia.org/wikipedia/commons/d/de/Color-Green.JPG" width="298" height="148" alt="RP-TEXT" style="background-color: #3366FF" />
<h6 class="products">RP-TEXT</h6>
</div><!--
--><div class="home-featured-class-3">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</div>
<div class="clear"></div>
</div>
</div>
JSFiddle.
I'm trying to get rid of many divs on my page so I wonder if this "tile" could be done without using one.
Something like this:
<a href="mks.html" class="big-tile big-tile-1">
<h1>town<br>
library</h1>
</a>
The anchor tag would have a background: url(big-tile-1) top no-repeat; I guess. Big-tile would have static width and height. But how do I style the h1? Can You help me please?
You could do something like this: JSFiddle Demo
CSS
.big-tile {
border:10px solid #ccc;
display:inline-block;
position:relative;
height:200px;
width:200px;
color:#fff;
background:url("http://lorempixel.com/400/200/nature/");
}
.big-tile h1 {
margin:0;
background:teal;
position:absolute;
padding:20px;
bottom:0;
left:0;
right:0;
}
Or if you want the image in the markup and not as a background image - you could do this : http://jsfiddle.net/UFUq5/3/
Demo Fiddle
HTML
<a href="#">
town<br />
library
</a>
CSS
a {
display:inline-block;
height:450px;
width:300px;
background-image:url(http://phaseoneimageprofessor.files.wordpress.com/2013/07/iqpw29_main_image_.jpg);
background-color:teal;
background-size:300px 300px;
background-repeat:no-repeat;
padding-top:350px;
padding-left:50px;
box-sizing:border-box;
color:white;
text-decoration:none;
font-family:arial;
font-size:20px;
border:10px solid #c0c0c0;
}
technically, you wouldn't need to use the big-tile-1 class. but you could do something like this: http://jsfiddle.net/RU23A/1/
with a couple changes:
1. add an image to the background url
2. change the font to whatever that font is.
You can do this:
<a id="image-overlay" href="mks.html" class="big-tile big-tile-1">
<img src="your image">
<h1> town <br> library </h1>
</a>
then your css:
#image-overlay{
width: 300px;
height: 500px;
position: relative;
border: 10px #999 solid;
border-radius: 1px;
}
#image-overlay h1{
position: absolute;
bottom: 0;
left: 0;
background-color: green ////whatever your choice
color: white;
padding: 10px;
font-family: //your choice
font-size: 20px;
}
Good morning!
I have an image and text I would like to combine. I've included the final result I want. So far, with about 20 hours into it, I stil cant seem to create a table using various sections of the image. (My last result: tradecaptain.com/landingpage) I can post the CSS I wrote but as I am new and it is all inline, it's a mess. I have added the image, the final result I want onto the webpage since I can't post an image here. It is below the result of my last attempted table.
I'm at the point of just placing my image with text as one really big image. I would appreciate any pointers in the right direction. If at all possible.
Thank you everyone!!
Try something like this:
CSS
#img{
width: 200px;
height: 200px;
background-image:url(yourImage.png);
background-repeat:no-repeat;
background-position: top left;
}
#txt{
position: absolute;
margin-left: 20px;
margin-right: 20px;
}
HTML
<div id="img">
<div id="txt">
your text
</div>
</div>
Here's my work on how to get it done.
HTML:
<div id="sample">
<div class="a"><div>Take command of your trading</div></div>
<div class="b">with the </div>
<div class="b">Moneymap</div>
<div class="a"><div>Trade the market with confidence</div></div>
</div>
CSS:
#sample {
width:864px;
height:264px;
background-image:url('http://tradecaptain.com/images/CommandMountain.png');
background-repeat:no-repeat;
background-position:right;
}
.a{
text-align:center;
font-size:50px;
}
.a div
{
background:yellow;
width:80%;
margin:0 auto;}
.b{
width:350px;
text-align:right
}
Just give you the idea.
Hope you manage to get it done.
http://jsfiddle.net/EY2VP/1/
this way you can combined the background image with text. Ofcoure you have to play with the value to fit it with your design, but the dummy concept is here.
Here is the CSS and HTML Code. Here is the working Demo link here.
http://jsbin.com/qunojidi/4/
---CSS Code ---
header{display:block;}
div#bgimage
{
background:url("http://lorempixel.com/400/284") no-repeat center right;
width:670px;
height:284px;
}
div#bgimage p
{
font:arial;
font-size:1.2em;
width:290px;
margin:0; padding:0;
}
div#bgimage h3 em, div#bgimage h3
{
font-size:1.5em;
word-break: break-all;
width:260px; display:block;
text-align:right;
margin:0 0;
padding:0;
}
h1, h2
{
background-color:rgba(245, 217, 110, 0.5);
color:#2D2376;
font-size:2.1em;
display:inline-block;
text-align:right;
margin:5px 0; padding:5px 0;
}
----HTML Code ---
<header>
<div id="bgimage">
<h1>Take Command of your Trading </h1>
<h3>with the <em>Money Map</em></h3>
<h2>Trade the markets with confidence</h2>
<p>Read the Market. Rule your Risk. Take the Money.
Trade Forex, futures, commodities and stocks</p>
</div>
</header>
Thank you everyone for your generous time and assistance! I'm new to CSS so this was not only helpful in this case, but also for my learning process. I've called Heaven and reserved first class seats for all of you :)
I've had to play around with it to get it to look like I want. Hopefully, I've not done anything invalid. I've only tested it on Chrome. Here's what I finally went with:
HTML
<div id="LandingImage">
<h1>
Take Command of your trading</h1>
<h2>
with the</h2>
<h3>
Moneymap</h3>
<p><text1>Read the market. Rule your risk. Take the money.</text1> <text2>Trade forex, futures, commodities and stocks.</text2></p>
<h4>
Trade the markets with confidence</h4>
CSS
header{display:block;}
#LandingImage {
background:url("http://tradecaptain.com/images/CommandMountain.png") no-repeat center right;
margin:50px 0px 0px 0px;
width:856px;
height:284px;
}
#LandingImage h1 {
background-color:rgba(255, 210, 50, 0.7);
color:rgb(0, 0, 100);
font-size:38px;
display:inline-block;
text-align:right;
margin:0px 0px 0px 50px;
padding:15px 8px 15px 8px;
}
#LandingImage h2 {
font-size:28px;
width:340px;
display:block;
color:rgb(0, 0, 100);
text-align:right;
margin:30px 0px 0px 0px;
padding:0;
}
#LandingImage h3 {
font-size:50px;
word-break: break-all;
width:340px;
display:block;
color:rgb(0, 0, 100);
text-align:right;
margin:30px 0px 0px 0px;
padding:0;
}
#LandingImage text1 {
color:rgb(0, 0, 100);
font-size:16px;
display:block;
width:348px;
padding:0px 0px 0px 0px;
margin:35px 0px 0px 0px;
}
#LandingImage text2 {
color:rgb(0, 0, 100);
font-size:16px;
display:block;
width:339px;
padding:0px 0px 0px 0px;
margin:5px 0px 0px 25px;
}
#LandingImage h4 {
background-color:rgba(255, 210, 50, 0.7);
color:rgb(0, 0, 100);
font-size:38px;
display:inline-block;
text-align:right;
margin:4px 0px 0px 5px;
padding:15px 8px 15px 8px;
}
Granted, it's not pretty. But hey, I'm new ;) Any further educational pointers are appreciated. Now I'm off to figure out how to put two links under it and another table! Wish me luck.
Gratefully,
Alexander
I have built a website that has a popup to a youtube video when the visitor clicks on the play button, below is my code. It works on iPad, iPhone and Mac but will not work on a PC. Would somebody be kind enough to explain to me what I have done wrong and why the popup will not open to the youtube video on a PC? The link still works as I can open the video in a New Tab, it just wont open automatically in the pop up. I have tested it on 3 PC's but nothing.
Thanks guys.
HTML
<div class="description centerAbsolute">
<h1 class="proximaBold antialiased"><span class="style8">BIG</span>SMILE</h1>
<h2 class="proximaLite antialiased">Cambridge</h2>
<span class="cta floatL">through the eyes of a customer</span><span class="playIco floatL"></span>
</div>
CSS
/* --- VIDEO --- */
#main>header>.video>#youtube{opacity: 0; background: rgba(0, 0, 0, 0.6);}
#main>header>.video>#youtube>.close{
width: 40px;
height: 40px;
top: 50%;
left: 0px;
}
#main>header>.video>#youtube>.close>a{
display: block;
width: 40px;
height: 40px;
background: url(../img/close%402x.png) no-repeat center;
background-color: #32ADC3;
background-size: 40px;
vertical-align: bottom;
}
#main>header>.video{width:100%; height:500px; background:url(../img/bg-video.jpg) no- repeat center top; background-size:cover; color:#FFF; }
#main>header>.video>.description{width:700px; margin-top:-185px; margin-left:-350px; text-align:center;}
#main>header>.video>.description>h1{font-size:118px; line-height:118px; margin:0px 0px 0px 0px; letter-spacing:0.12em;}
#main>header>.video>.description>h2{font-size:36px;line-height:35px; margin:15px 0px 0px 0px; letter-spacing:0.12em; -webkit-font-smoothing: antialiased;}
#main>header>.video>.description>.play{text-decoration:none; color:#FFF; display:block; height:70px; width:650px; margin:40px auto 40px auto; background:#32ADC3;}
#main>header>.video>.description>.play>.playIco{ display:block; width:70px; height:70px; background:url(../img/play-ico.png) center no-repeat; border-left:solid 1px #32ADC3;}
#main>header>.video>.description>.play>.cta{ width:578px; font-size:16px; text-transform:uppercase; line-height:72px; letter-spacing:0.25em;-webkit-font-smoothing: antialiased;}
#main>header>.video>.description>.share{ width:140px; margin:auto;}
#main>header>.video>.description>.share>h3{width:136px; font-size:12px; line-height:16px; margin:auto; text-align:center; letter-spacing:0.3em;}
#main>header>.video>.description>.share>h3>.title{ margin:auto 18px auto 18px;}
#main>header>.video>.description>.share>h3>.line{ display:block; width:20px; height:1px; margin-top:5%; border-top:solid 1px #FFF;}
#main>header>.video>.description>.share>ul{ margin-left:-8px; margin-bottom:0px;}
#main>header>.video>.description>.share>ul>li{width:25%;}
#main>header>.video>.description>.share>ul>li>a{ display:block; width:30px; height:30px; border-radius:15px;}
#main>header>.video>.description>.share>ul>li>a:hover{ background-color:#32ADC3;}
#main>header>.video>.description>.share>ul>li>a>img{ margin-top:6px; text-align:center;}
Amendment : My problem is very precise, and nobody has yet solved the issue, so I know it's not really allowed but if you visit www.mildenhire.com/bigsmile you will see the website there and the video option loads immediately and is the first thing you see. I have no idea why it works on mac and iOS but not on PC. Could somebody please visit this page, troubleshoot it and tell me what I have done wrong? This has been a big learning curve. Thanks
I would try the iframe embed instead:
<iframe width="640" height="360" src="//www.youtube.com/embed/krlR2-YGk4s?rel=0" frameborder="0" allowfullscreen></iframe>
I am trying to make a large button with 2 lines of text that looks something like:
What I want
This is my current JSFiddle showing what I've "accomplished"
I am fairly new to asp.net and programming in general so excuse my poor CSS.
Thanks for any help that anyone can offer.
The HTML:
<div class="bigGreenButton"> <a href="/Liquor/specialorder/supplier-info">Submit a special order request <br />
for information ➧
</a> </div>
The CSS:
.bigGreenButton a{
font-family:'TradeGothic LT CondEighteen';
font-size:18px;
background-color:#60a74a;
color:white;
font-weight:bold;
padding-bottom:10px;
padding-top:10px;
padding-left:25px;
padding-right:25px;
text-transform:uppercase;
text-decoration:none;
height:auto;
width:auto;
text-align:center;
}
.bigGreenButton a:hover {
background-color:#cccccc;
}
button {
text-align: center;
padding: 0px 0px 0px 0px;
border: none;
}
Add this to your css:
.bigGreenButton a{
display: inline-block;
...
}
You can see it here.
Change display since there's not a block inside your link and set the width how you want it.
.bigGreenButton a{
...
display: block;
width: 400px;
}
Shown here