i want to make the text "TITLE" in this html and css code,
#headerf {
background-color: #717571;
overflow-x: hidden;
position: fixed;
z-index: 99999;
}
.headert {
position: fixed;
z-index: 9999999;
width: 100%;
height: 60px;
top: 0px;
}
.headert h3 {
text-align: center;
color: white;
margin-top: 30px;
display: inline-block;
}
.headert a.h-left {
float: left;
color: white;
font-size: 1.5em;
margin-left: 1em;
margin-top: 30px;
position: relative;
display: inline-block;
}
.headert a.h-right {
float: right;
color: white;
margin-top: 30px;
position: relative;
margin-right: 1em;
font-size: 1.5em;
display: block;
}
<div id="headerf" class="headert">
LEFT
<h3>TITLE</h3>
RIGHT
</div>
or this http://jsfiddle.net/didinz/6vp34frd/
i have done everything i know but it still doesnt work(and become worse)
and i'm stuck
Thanks in advance guys ^_^
#headerf {
background-color: #717571;
overflow-x: hidden;
position: fixed;
z-index: 99999;
text-align: center;
}
.headert {
position: fixed;
z-index: 9999999;
width: 100%;
height: 60px;
top: 0px;
}
.headert h3 {
text-align: center;
color: white;
margin-top: 30px;
display: inline-block;
}
.headert a.h-left {
float: left;
color: white;
font-size: 1.5em;
margin-left: 1em;
margin-top: 30px;
position: relative;
display: inline-block;
}
.headert a.h-right {
float: right;
color: white;
margin-top: 30px;
position: relative;
margin-right: 1em;
font-size: 1.5em;
display: block;
}
h3 {text-align: center; display: block; width: 90%; margin: auto; left: 5%; position: absolute; top: 5px;}
<div id="headerf" class="headert">
<h3>TITLE</h3>
LEFT
RIGHT
</div>
If it is one line of text and/or image, then it is easy to do. Just use:
text-align: center;
vertical-align: middle;
line-height: 90px; /* the same as your div height */
that's it. If it can be multiple lines, then it is somewhat more complicated. But there are solutions on http://pmob.co.uk/ Look for "vertical align".
Since they tend to be hacks or adding complicated divs... I usually use a table with a single cell to do it... to make it as simple as possible.
Use it this way:
h3 {
text-align: center;
display: block;
width: 90%;
margin: auto;
position: absolute;
top: 5px;
left: 5%;
}
Snippet
#headerf {
background-color: #717571;
overflow-x: hidden;
position: fixed;
z-index: 99999;
}
.headert {
position: fixed;
z-index: 9999999;
width: 100%;
height: 60px;
top: 0px;
}
.headert h3 {
text-align: center;
color: white;
margin-top: 30px;
display: inline-block;
}
.headert a.h-left {
float: left;
color: white;
font-size: 1.5em;
margin-left: 1em;
margin-top: 30px;
position: relative;
display: inline-block;
}
.headert a.h-right {
float: right;
color: white;
margin-top: 30px;
position: relative;
margin-right: 1em;
font-size: 1.5em;
display: block;
}
h3 {text-align: center; display: block; width: 90%; margin: auto; left: 5%; position: absolute; top: 5px;}
<div id="headerf" class="headert">
<h3>TITLE</h3>
LEFT
RIGHT
</div>
Related
I am trying to deploy my first website. Unfortunately I have a problem with media queries. I don't know how to style media queries for mobile devices for one of my sections.
.row {
margin-right: 0px;
margin-left: 0px;
}
.container-fluid {
padding-right: 0px;
padding-left: 0px;
}
.header {
width: 100%;
height: 100%;
position: relative;
}
.logo-small img {
margin: 0 auto;
width: 30%;
height: 10%;
padding-top: 30px;
margin-left: 60px;
}
.logo-small-retina {
margin: 0 auto;
display: none;
}
.main-logo {
position: relative;
text-align: center;
margin-bottom: 50px;
}
.main-logo img{
width: 15%;
height: 10%;
}
.main-logo-retina{
display: none;
}
.dream-header{
position: relative;
text-align: center;
margin-left: -40px;
}
.dream-header img{
width: 40%;
height: 10%;
}
.dream-header-retina{
display: none;
}
.map{
width: 100%;
height: 100%;
}
.map-retina{
display: none;
}
.ireland{
position: relative;
text-align: center;
margin-top: 65px;
}
.ireland img {
position: relative;
width: 40%;
height: 10%;
margin-top: -4%;
}
.ireland-retina{
display: none;
}
.sandra img {
/*display: block;
position: relative;
width: 105px;
margin-top: -50%;
margin-left: 14%;*/
}
.rollOver {
display: block;
width: 2%;
position: relative;
margin-left: 47.69%;
margin-top: -22.5%;
}
.sandra{
display: none;
position: relative;
width: 250%;
margin-top: -790%;
margin-left: -176%;
}
}
.sandra img {
display: block;
width: 100%;
position: relative;
}
.text-map{
position: relative;
text-align: center;
margin-top: 20%;
margin-bottom: 5%;
}
.text-map img {
position: relative;
width: 40%;
height: 10%;
display: block;
margin-top: 24%;
margin-left: 27%;
margin-right: 27%;
}
.text-map-retina{
display: none;
}
.iradio{
margin-top: 20px;
}
.iradio-logo{
position: relative;
text-align: center;
margin-top: 40px;
margin-bottom: 40px;
}
.iradio-logo-retina{
display: none;
}
.iradio-logo img{
width: 10%;
height: 5%;
}
.garry-text{
position: relative;
text-align: center;
margin-top: 40px;
margin-bottom: 40px;
}
.garry-text img{
width: 20%;
height: 10%;
}
.garry-text-retina{
display: none;
}
.garry{
width: 100%;
/*margin-top: 20px;*/
}
.garrybg{
position: relative;
text-align: center;
margin-top: 40px;
margin-bottom: 40px;
background: url("../images/garry-bg.png") no-repeat;
background-size: 100%;
text-align: center;
}
.centerVideo {
margin: auto;
width:33%;
}
.garrybg-retina{
display: none;
}
.enter{
width: 100%;
/*margin-top: 20px;*/
}
.enter-text{
position: relative;
text-align: center;
margin-top: 40px;
margin-bottom: 5px;
}
.enter-text img{
width: 10%;
height: 5%;
mar
}
.enter-text-retina{
display: none;
}
.win{
width: 100%;
height: 80%;
margin-top: 50px;
padding-top: 50px;
/*margin-top: 20px;*/
}
.chancetowin{
position: relative;
text-align: center;
margin-top: 40px;
margin-bottom: 40px;
}
.chancetowin img{
width: 70%;
height: 55%;
mar
}
.chancetowin-retina{
display: none;
}
::-webkit-input-placeholder {
color: red;
font-weight: bold;
}
:-moz-placeholder {
color: red;
font-weight: bold;
}
:-ms-input-placeholder {
color: red;
font-weight: bold;
}
.social-retina{
display: none;
}
.form-control{
margin-bottom: 5px;
}
.btn-submit{
width: 75%;
margin-left: auto;
margin-right: auto;
margin-top: 25px;
margin-bottom: 50px;
display: block;
}
#btn {
border: 0;
text-align: center;
width: 80px;
margin-left: 50%;
margin-right: 50%;
margin-top: 10px;
}
#share{
text-align: center;
display: block;
width: 30%;
height: 10%;
margin-right: auto;
margin-left: auto;
padding-top: 20px;
padding-bottom: 20px;
}
.player .title{
display: none;
}
.fb-share-button{
margin: 4px 10px 0px 10px;
margin
display: block;
position: relative;
float: left;
}
.twitter-share-button{
margin: 10px;
display: block;
position: relative;
}
.footer{
position: relative;
width: 100%;
height: 100%;
}
.footer-vid{
width: 100%;
height: 700px;
}
.footer-vid-retina{
display: none;
}
#media only screen and (max-width: 400px){
.container-fluid{
width: 100%;
}
.row{
position: relative;
width: 100%;
}
.header{
width: 100%;
position: relative;
}
.logo-small{
display: none;
}
.logo-small-retina{
display: block;
position: relative;
padding-top: 10px;
margin-left: 10px;
}
.main-logo{
display: none;
}
.main-logo-retina{
display: block;
}
.main-logo-retina img{
position: relative;
width: 150px;
margin-top: 10px;
margin-bottom: 10px;
margin-left: 105px;
margin-right: 105px;
}
.dream-header{
display: none;
}
.dream-header-retina{
display: block;
}
.dream-header-retina img {
position: relative;
width: 318px;
margin-top: 10px;
margin-bottom: 10px;
margin-left: 7px;
margin-right: 7px;
}
.map{
display: none;
}
.map-retina{
display: block;
}
.ireland{
display: none;
}
.ireland-retina{
display: block;
}
.ireland-retina img {
position: relative;
width: 318px;
margin-top: -5px;
margin-bottom: 10px;
margin-left: 7px;
margin-right: 7px;
}
.text-map{
display: none;
}
.text-map-retina{
display: block;
}
.text-map-retina img {
position: relative;
width: 318px;
margin-top: 35px;
margin-bottom: 10px;
margin-left: 7px;
margin-right: 7px;
}
.iradio{
width: 330px;
position: relative;
}
.iradio-logo{
display: none;
}
.iradio-logo-retina{
display:block;
}
.iradio-logo-retina img {
position: relative;
width: 40%;
margin-top: -12px;
margin-bottom: 10px;
margin-left: 93px;
margin-right: 69px;
}
.garry-text{
display: none;
}
.garry-text-retina{
display: block;
}
.garry-text-retina img {
position: relative;
width: 200px;
margin-top: 0;
margin-bottom: -31px;
margin-left: 69px;
margin-right: 69px;
}
.garrybg{
background: none;
}
.centerVideo{
width: 100%;
}
/* .garrybg-retina{
display: block;
height: 40px;
}
.garrybg-retina img {
position: relative;
width: 400px;
margin-top: -246px;
margin-bottom: -240px;
margin-left: -23px;
margin-right: 69px;
}*/
#garry-vid-retina{
margin-left: 117px;
margin-bottom: 0;
z-index: 1;
bottom: -48px;
}
.enter-text{
display: none;
}
.enter-text-retina{
display: block;
}
.enter-text-retina img {
position: relative;
width: 200px;
margin-top: -136px;
margin-bottom: -138px;
margin-left: 65px;
margin-right: 65px;
}
.win {
position: relative;
width: 100%;
height: 80%;
margin-top: 44px;
padding-top: 50px;
/* margin-top: 20px; */
}
.chancetowin{
display: none;
}
.chancetowin-retina{
display: block;
}
.chancetowin-retina img{
position: relative;
width: 340px;
margin-top: -35px;
margin-left: 6px;
margin-right: 6px;
}
.social{
display: none;
}
.social-retina{
display:block;
position: relative;
width: 100%;
}
.footer-vid{
position: relative;
width: 100%;
max-height: 100%;
height: 242px;
}
}
<section class="contact-us" id="contact">
<div class="containernew">
<h2>text</h2>
<p>text text text text text text text text text text text text text text text text</p>
<p style="margin-bottom: 10px;"><i class="fas fa-phone"></i> 312 432 321</p>
<p><i class="fas fa-envelope"></i> #gmail.com</p>
<div class="contact-box">
<form action="POST" data-netlify=true netlify name="form">
<div class="name-email"><input type="text" placeholder="Imię " name="Imię">
<input type="email" placeholder="Email" name="Email"></div>
<div class="subject"><input type="text" placeholder="Temat" name="Temat"></div>
<div class="message"><textarea name="Your text" id="" cols="30" rows="10"
placeholder="Twoja wiadomość"></textarea></div>
<button>Wyślij wiadomość</button>
<div data-netlify-recaptcha ></div>
</form>
</div>
</div>
</section>
I tried to style .containernew why media queries but width and max-width seem to not work somehow.
It would be useful if you could put your code through the W3C validator https://validator.w3.org/
There are several problems in the CSS given in the question such as a spurious right brace, plus some ‘floating’ declarations that are not terminated properly, e.g. margin
If you still have problems when these errors are removed, put a snippet into your question which shows the problem you are having and we can have another look.
I have a couple of vertically aligned divs which i want to be fixed when window is resized horizontally.
Here is the CSS. Any idea what is missing here? :
.wrapper {
display: block;
float: right;
width: 350px;
margin-right: 5px;
}
.upper-div {
float:right;
margin-top: 10px;
text-align: left;
margin-right:5px;
display: block;
top: 7px;
margin-top: 0px;
margin-bottom: 4px;
font-size: 11px;
height: 11px;
line-height: 11px;
position: absolute;
z-index: 1;
width: inherit;
text-align: right;
}
.lower-div {
line-height: 11px;
font-size: 11px;
bottom: 7px;
height: 11px;
position: absolute;
z-index: 0;
display: block;
width: inherit;
text-align: right;
}
My text is pushing div element that contains them below.
slidepassos{
position: relative;
height: 100vh;
width: 100%;
background: rgba(0,0,0,1);
float: left;
margin-top: -1px;
}
#anchorHow{
margin-top: 65px;
width: 100%;
float: left;
}
.swipe {
overflow: hidden;
visibility: hidden;
position: relative;
}
.swipe-wrap{
overflow: hidden;
position: relative;
}
.swipe-wrap > div {
float: left;
width: 100%;
position: relative;
}
.passo-um{
height: 100vh;
width: 100%;
background: #000101;
}
.passoumback{
height: 100%;
width: 100%;
background-image: url("../img/passoumu.jpg");
background-position: top center;
}
.passoumgrad{
height: 100vh;
width: 100%;
background: rgba(0,37,63,0.7);
}
.passo-um h1{
color: white;
font-weight: bold;
font-size: 45px;
text-align: center;
}
.passo-um h2{
color: #EBAC00;
font-weight: bolder;
font-size: 53px;
text-align: center;
margin-top: 15px;
margin-left: 35%;
}
.passo-um p{
color: white;
padding: 18px 8%;
font-size: 20px;
font-weight: lighter;
text-align: center;
margin-top: 23px;
float: left;
}
.passoumilu {
width: 300px;
float: left;
margin-left: 9%;
margin-top: 50px;
}
.swipeleftcontent{
z-index: 1;
background-size: 60px 60px;
margin-left: 157px;
width: 60px;
height: 60px;
position: absolute;
bottom: 14%;
}
<div id="slidepassos" class="swipe slidepassos">
<div class="swipe-wrap">
<div class="mySlides">
<div class="passo-um">
<h1>How?</h1>
<h2>Step 1:</h2>
<img src="img/passoumilu.svg" class="passoumilu">
<p>Do your coach oriented WOD. Remember, know your limits and try to break them.</p>
<div class="passoumback">
<div class="passoumgrad"></div>
</div>
<img src="img/swipeleft.png" class="swipeleftcontent">
</div>
</div>
</div>
</div>
image showing the text on top of the DIV instead inside it.
example
Ive tried to mess with the floats, and inline-blocks, but nothing affects it. Dont know how to fix it.
We have two boxes associated with What's Nearby, and Crafting the Perfect Villa Vacation. We would like the left (What's Nearby) box to act very similar to the right (Crafting the Perfect Villa Vacation) box, in that the left box should scale while aligned to the top of the gray container. We have tried many methods, and are coming up short! So basically, the left box should be able to scale while being vertically aligned to the bottom, as the right box does.
Here is our code...
HTML:
<div id="whats-nearby">
<h1>What's Nearby</h1>
<div class="orange-triangle-180"><img src="images/orange-triangle.png"/></div>
<img src="images/whats-nearby.jpg"/>
</div>
<div id="crafting-villa-vacation">
<h1>Crafting the perfect villa vacation</h1>
<div class="orange-triangle-180"><img src="images/orange-triangle.png"/></div>
<img src="images/crafting-villa-vacation.jpg"/>
<h3 class="share-property">Share This Property</h3>
</div>
CSS:
#crafting-villa-vacation {
float: right;
width: 52%;
display: table;
margin-right: 3%;
margin-top: 200px;
margin-bottom: -119px;
}
#crafting-villa-vacation .orange-triangle-180 img{
position: absolute;
top: -18px;
right: 10px;
width: 35px;
}
#crafting-villa-vacation img {
width: 100%;
float: left;
display: table-cell;
vertical-align: bottom;
}
#whats-nearby {
position: absolute;
bottom: 0;
top: 584px;
left: 60px;
z-index: 1;
width: 27%;
}
#whats-nearby img {
width: 100%;
display: table-cell;
}
#whats-nearby .orange-triangle-180 img{
width: 35px;
position: relative;
bottom: 18px;
right: 5px;
margin-right: 420px;
}
See what you can do with this. I messed around with it for a little bit. I got pretty close.
HTML:
<div id="whats-nearby">
<h1>What's Nearby</h1>
<div class="orange-triangle-180"><img src="images/orange-triangle.png"></div>
<img src="images/whats-nearby.jpg">
<h3 class="share-property"></h3>
</div>
CSS:
#crafting-villa-vacation {
float: right;
width: 52%;
display: table;
margin-right: 3%;
margin-top: 200px;
margin-bottom: -119px;
}
#crafting-villa-vacation h1 {
color: #f26649;
text-transform: uppercase;
font-family: 'Minerva', serif;
text-align: left;
padding-bottom: 10px;
font-size: 18px;
}
#crafting-villa-vacation .orange-triangle-180 img{
position: absolute;
top: -18px;
right: 10px;
width: 35px;
}
#crafting-villa-vacation img {
width: 100%;
float: left;
display: table-cell;
vertical-align: bottom;
}
#whats-nearby {
float: left;
width: 27%;
display: table;
margin-left: 5%;
margin-top: 200px;
margin-bottom: -91px;
}
#whats-nearby h1 {
color: #f26649;
text-transform: uppercase;
font-family: 'Minerva', serif;
text-align: right;
padding-bottom: 10px;
font-size: 18px;
}
#whats-nearby .orange-triangle-180 img{
position: absolute;
width: 35px;
}
#whats-nearby img {
width: 100%;
float: left;
display: table-cell;
vertical-align: bottom;
}
#whats-new h3.share-property {
background-color: #0073AE;
text-transform: uppercase;
font-size: 15px;
text-decoration: underline;
color: #fff;
width: 200px;
padding: 5px 10px;
position: relative;
top: -28px;
left: 0;
font-family: 'Minerva', serif;
clear: both;
}
This is what worked for me. See if this will help out. It's very similar to the box floating to the right but instead it floats left with a little different values for positioning.
#whats-nearby {
float: left;
width: 27%;
display: table;
margin-left: 60px;
margin-top: 73px;
margin-bottom: -119px;
}
Quick question, I need help and have no idea what to do, because I know nothing about html/css and got this as a bonus task along with other programming things.
What I have:
What I would like to have:
Here is css code
.offer-small { width: 278px; height: 209px; position: relative; margin-bottom: 25px; }
.offer-small img { width: 278px; height: 209px; }
.offer-small .mask { width: 278px; height: 209px; cursor: pointer; position: absolute; top: 0; left: 0; background: url('../images/photo-small-mask.png'); }
.offer-small .desc { display: none; font-size: 10pt; width: 258px; height: 189px; padding: 10px; position: absolute; top: 0; left: 0; background: url('../images/photo-small-black-transparent.png'); color: white; text-shadow: 1px 1px #000000}
.offer-small .desc p { font-size: 9pt; color: #f2f0e4; }
.offer-small .desc table.compare { width: 160px; height: 48px; margin: 0 auto 0 auto; background: url('../images/offer-table.png'); color: #f2f0e4; }
.offer-small .desc table td { text-align: center; padding-bottom: 10px; }
.offer-small .desc table td.small { font-size: 8pt; }
.offer-small .title { width: 258px; background: url('../images/offer-transparent.png'); padding: 2px 10px; position: absolute; top: 120px; left: 0; }
.offer-small .title strong { font-size: 9pt; color: #ffffff; }
.offer-small .title small { font-size: 8pt; color: #f2f0e4; }
.offer-small .title small strong { font-size: 8pt; color: #f2f0e4; }
.offer-small .view-offer { position: absolute; top: 160px; left: 150px; }
.view-offer { display: block; width: 120px; height: 44px; background: url('../images/button-view-offer.png'); }
.btnSendOrder { width: 260px; height: 75px; border: 0; background: url('../images/button-send-order.png'); cursor: pointer; }
.toLeft { float: left; margin-right: 25px; }
Html/smarty code:
{if $random}{foreach item=item from=$random}
<div class="offer-small">
<img src="{$smarty.const.APP_URL}/userfiles/photos/{if $item.item_photo}s_{$item.item_photo}{else}blank_small.jpg{/if}" alt="" />
<div class="desc">
<strong>{$item.item_name|truncate:30}</strong>
<p>{$item.item_short_description|truncate:120}</p>
<p align="right"></p>
</div>
<div class="title">
<strong>{$item.item_name|truncate:30}</strong><br/><small>Cena teraz: <strong>{$item.item_cost_now|money} zł</strong> zamiast <strong>{$item.item_cost_before|money} zł</strong></small><br/><br/>
<strong>OSZCZĘDZASZ <big>{$item.item_cost_before-$item.item_cost_now|money}</big> zł</strong>
</div>
</div>
{/foreach}{/if}
Tips are welcome too.
I mean I can handle making grid if someone will show me how to break this stupid list.
An easy way is to just float the divs of class .offer-small left:
.offer-small {
width: 278px;
height: 209px;
position: relative;
margin-bottom: 25px;
float:left;
}
As long as you have them all within a container element with a fixed width, they should fit next to each other nicely, wrapping to the next line automatically.