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
Related
I wana section box width height according text size. i try with below codes its working but not best width height of section box according to text. I design three css ids 1st is #wbp_row second is #wbp_col and last one is text id name is #threedtext
I try these codes with html5 and css3 techniques.
My css Code:
#wbp_row {
position:relative;
display:table;
border:solid 1px #0F0;
min-width:auto;
max-width:960px;
max-height:auto !important;
margin: 0 auto;
}
#wbp_col {
position:relative;
display:table-row;
width:320px;
min-height:auto!important;
border:1px solid #000;
float:left;
margin:0 0 0 0px;
padding:0;
}
#wbp_row #threedtext {
font-size:70px;
max-height:auto !important;
text-align:center;
font-family:Arial, Helvetica, sans-serif;
/*text-shadow: 0px 4px 0px rgba(82,82,82,.80),
2px 4px 3px rgba(0, 0, 7, 0.50),
3px 8px 3px rgba(0,0,0,.40),
0px 12px 10px rgba(0,0,0,0.1);*/
color: rgba(141, 198, 63, 1);
padding:0;
line-height:normal;
overflow:auto;
position:relative;
border:1px solid #F00;
}
HTML Codes :
<section id="wbp_row">
<Section id="wbp_col">
<p id="threedtext">Web</p>
</Section><!--Cols codes end-->
<Section id="wbp_col">
<p id="threedtext">Brand</p>
</Section><!--Cols codes end-->
<Section id="wbp_col">
<p id="threedtext">Print</p>
</Section><!--Cols codes end-->
</section><!--row code end-->
If you set width:auto in "#wbp_col" like this
#wbp_col{width: auto;}
So section is adjust its height and width according to text size.
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;
}
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
I have this html
<div class="p-box">
<div class="p-img"></div>
<h3>title</h3>
<div class="txt">some txt</div>
</div>
with this css.
.p-box {
width:253px;
height:155px;
position:relative;
float:left;
overflow:hidden;
background: url(../images/p-box-bg.png) top left no-repeat;
}
.p-box h3 {
color:#FFF;
width:253px;
text-align:center;
font-size:12px;
height:22px;
line-height:22px;
display:block;
}
.p-img {
position:absolute;
top:1px;
left:1px;
width:253px;
height:155px;
z-index:5;
background: url(../images/p-img-bg.png) top left no-repeat;
}
.p-box .txt{
width:249px;
height:20px;
background: url(../images/p-img-txt-bg.png) top left no-repeat;
position:absolute;
bottom:2px;
left:2px;
z-index:50;
text-align:right;
color:#FFF;
font-size:12px;
line-height:20px;
}
In firefix all ok, but in IE i can't see my H3 over the p-img and p-img don't feel the container overflow..
can anyone help me??
Thx.
I would recommend on your H3, set it to something more particular, ie: an id. Once done, set the background image in the new id tag, not the H3 element in css. so:
.p-box #h3image {
color:#FFF;
text-align:center;
font-size:12px;
display:block;
enter code here
width:253px;
height:22px;
padding-top: 133px;
z-index:5;
background: url(../images/p-img-bg.png) top left no-repeat;
}
Note that the padding-top 133 px + height of 22px will make the entire height of the container 155px; being the size of your image. As the padding from the top is 133, this will leave 22px for the text to be in place, as the image is a background, text is in the foreground, fully seo compliant and browser compatible.
:)
As some articles allude with on IE's z-index bug, give the h3 element a high z-index (at least, higher than the z-index=5 given to .p-img).