I am trying to create an event list with image on the left hand side, and text box on the right hand side describing it (similar to evenbrite). However, I am having the following issues:
creating a box for the text
align the image with the box
change the padding, margin of the text so that it fits inside the box.
Thank you!
html:
<img src="bionic.jpg" alt="festo bionic" class="events">
<div class="event_description">
<p> Robotics Demo </p>
<p> All Day on October 4th, 2018. R:Lab, Emirates Tower</p>
<p> Join us in interacting with the most technologically advanced robots. </p>
</div>
css:
body {
text-align: center;
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
padding: 0;
margin: 0;
}
h1 {
color: rgb(65, 56, 50);
font-size: 6em;
padding: 0px;
}
h2 {
color: rgb(61, 23, 30);
font-size: 3em;
}
img {
height: 350px;
}
p {
color: rgb(61, 23, 30);
padding: 30px;
font-size: 1.5em;
}
.events {
float:left;
height:200px;
width: 200px;
margin: 20px;
}
.event_description {
display:inline-block;
font-size: 1.0em;
float:right;
margin: auto;
padding: 0px;
border:5px lightgray;
}
Is this what you want? I have made the width of event_description
width: calc(100% - 240px);
This will align the description next to image
How this works
width: calc(100% - 240px);
240px is sum of width of the image and the margin applied to the image
You are subtracting 240px from the width of the parent.
body {
text-align: center;
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
padding: 0;
margin: 0;
}
h1 {
color: rgb(65, 56, 50);
font-size: 6em;
padding: 0px;
}
h2 {
color: rgb(61, 23, 30);
font-size: 3em;
}
img {
height: 350px;
}
p {
color: rgb(61, 23, 30);
padding: 30px;
font-size: 1.5em;
}
.events {
float: left;
height: 200px;
width: 200px;
margin: 20px;
}
.event_description {
width: calc(100% - 240px);
display: inline-block;
font-size: 1.0em;
float: right;
margin: auto;
padding: 0px;
border: 5px lightgray;
}
<img src="https://placehold.it/100x100" alt="festo bionic" class="events">
<div class="event_description">
<p> Robotics Demo </p>
<p> All Day on October 4th, 2018. R:Lab, Emirates Tower</p>
<p> Join us in interacting with the most technologically advanced robots. </p>
</div>
See if that's what you want.
I created an element <div class="content"></div> which will be the parent of the elements, and set the following property: display: flex;.
To set the border of .events_description the added solid
.content {
display: flex;
}
p {
color: rgb(61, 23, 30);
}
.events {
height:200px;
width: 200px;
margin-right: 30px;
}
.event_description {
flex-wrap:wrap;
display:inline-block;
font-size: 16px;
padding: 0px 15px 0 0;
border:5px solid lightgray;
}
p {
margin: 0;
}
<div class="content">
<img src="https://www.gettyimages.co.uk/gi-resources/images/Embed/new/embed1.jpg" alt="festo bionic" class="events">
<div class="event_description">
<p> Robotics Demo </p>
<p> All Day on October 4th, 2018. R:Lab, Emirates Tower</p>
<p> Join us in interacting with the most technologically advanced robots. </p>
</div>
</div>
Related
https://ibb.co/tL337vV
Look closely at the top right corner of the page you will see there is an empty space that I can't get rid of.
this only appears on actual phones and tablets not on desktop even if squeeze the browser.
<div class="banner">
<div class="banner-content">
<div class="banner-text">
<h1 class="welcoming"></h1>
</div>
</div>
</div>
*{
box-sizing: border-box;
padding: 0px;
margin: 0px;
}
html, body {
margin: 0;
}
body {
background-color: rgb(255, 253, 250);
}
/*header*/
.banner {
background-color: rgb(153, 217, 234);
max-height: 200px;
}
.banner-content {
padding: 20px;
align-items: center;
}
.banner-text {
flex-grow: 1;
line-height: 1.4;
}
.welcoming {
color: aliceblue;
text-align: center;
font-weight: bold;
font-size: 120px;
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif ;
text-transform: uppercase;
}
also you can see that the search bar isn't aligned properly, any suggestions?
<div class="wrapper">
<div class="search-input">
<a href="" target="_blank" hidden></a>
<input type="text" class="search-box" placeholder="Pick a topic, person, something">
<div class="autocom-box">
<!-- here list are inserted from javascript -->
</div>
<div class="icon"><i class="fas fa-search"></i></div>
</div>
</div>
.wrapper{
max-width: 810px;
margin: 150px auto;
}
.wrapper .search-input {
text-align: center;
margin: 15px;
}
.wrapper .search-input{
background: #fff;
width: 100%;
border-radius: 5px;
position: relative;
box-shadow: 0px 1px 5px 3px rgba(0,0,0,0.12);
font-family: 'Poppins', sans-serif;
}
Looks like something is causing an overflow on the page. One trick that I often use in such situation is going into dev tools and adding this style rule:
* {
background-color: rgba(2,2,240, 0.1) !important;
}
It lets you see every elements position and check which one is causing an overflow
Remove width: 100%; from your .wrapper .search-input class
Edit: I'm assuming you wanted to target your input field when applying the width: 100%;, so you could add this to your CSS:
.wrapper .search-box {
width: 100%;
}
This is my first html/css project. I tried to use nav and ul tags to put a Log in option on the top right corner over the image. When I do it shifts everything from the middle. I did google before posting but I haven't been successful. I am just wanting to know if I have to float it over or mess with the padding and margins? Here is the html markup`
<!DOCTYPE html>
<html>
<head>
<title>AudioPhile</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<section class="intro">
<div class="inner">
<div class="content">
<h1>Audio<img class="logo" src="https://image.ibb.co/n2A7gb/bar_diagram.png" alt=" folder with white music bars">Phile</h1>
<p>Create. Play. Share music anywhere, on any device with unlimited free storage.</p>
<input class="signup" type="email" id="myEmail" value="Type Your Email Here">
<a class="btn-1" href="#">Get Started</a>
<footer class="credits">© Natalie Pickrom</footer>
</div>
</div>
</section>
</body>
</html>`
The CSS:`#import url('https://fonts.googleapis.com/css?family=Archivo+Narrow|Nunito:200');
html, body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
.intro {
height: 100%;
width: 100%;
margin: auto;
background:linear-gradient(0deg,rgba(64,64,64,0.8),rgba(64,64,64,0.8)),url(https://preview.ibb.co/jZbkZw/james_stamler_153487.jpg) no-repeat 95% 95% ;
background-size: cover;
display: table;
top:0;
}
.intro .inner {
display: table-cell;
vertical-align: middle;
width: 100%
max-width: none;
}
.content {
max-width:500px;
margin: 0 auto;
text-align:center;
}
.content h1 {
font-family: "Archivo Narrow", Helvetica, sans-serif ;
color: #F9F3F4;
text-shadow: 0px 0px 300px #000;
font-size: 6em;
padding:0px;
margin:0px;
}
.content p {
font-family: Nunito, "Open Sans", sans-serif;
font-size: 1.253em;
color:#F9F3F4;
Paddding: 0px;
margin-top: 0px;
}
.signup {
border: 0px;
font-family: Nunito, "Open Sans", sans-serif;
letter-spacing: 2px;
color: rgba(128,128,128,0.7) ;
padding: 5px;
width: 67%;
}
.btn-1 {
border-radius:0px;
background-color: #008CBA;
font-family: Nunito, "Open Sans", sans-serif;
color:#F9F3F4;
text-align: center;
text-decoration: none;
text-transform: uppercase;
padding: 3px 10px 4px;
width:50%;
}
.credits {
font-family: Nunito, "Open Sans", sans-serif;
color:#F9F3F4;
text-align: center;
padding: 10px;
}
#media screen and (max-width: 768px) {
.content h1 {
font-size:4em;
}
.btn-1 {
padding: 2px 10px 3px;
width: 25%;
}
p {
font-size: .5em;
}
}
`
Here is the JSfiddle https://jsfiddle.net/1ysegrd6/
Here is what I want to achieve. I want log in where they have home subscribe
I want center text inside rounded rectangle (both vertically and horizontally), and also center this banner on page too, not sure how to make this correctly. The other elements need be centered too. Please advice how to make things correctly.
Here is code:
#wrapper {
position: relative;
width: 80%;
margin: auto;
text-align: center;
vertical-align: middle;
}
#rcorners {
border-radius: 15px;
border: 6px solid #ffffff;
padding: 20px;
width: 450px;
height: 40px;
}
body {
background-image: url(images/blaunew.png);
background-color: #001b33;
color: #ffffff;
font-family: 'Roboto';
font-size: 14px;
}
#rcorners {
font-family: 'Roboto';
font-size: 48px;
font-weight: 700;
font-style: normal;
Helvetica,
sans-serif;
}
p {
font-family: 'Roboto';
font-size: 32px;
Helvetica,
sans-serif;
}
.main {
margin-top: 20%;
//font-size: 35px;
}
footer {
font-size: 14px;
}
<head>
<title>centered construction</title>
<link href='https://fonts.googleapis.com/css?family=Roboto:400,700' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="wrapper">
<div class="main">
<h1 id="rcorners">Centered Text No1</h1>
<p>LOREM IPSUM DOLOR </p>
</div>
<footer>
<div>© Lorem Ipsum Dolor </div>
</footer>
</div>
remove width: 450px; and height: 40px from #rcorners.
Otherwise, if you want to keep it 450px wide, you may add margin: auto to #rcorners. It will solve your problem.
#import url('https://fonts.googleapis.com/css?family=Roboto:400,700');
#wrapper {
position: relative;
width: 80%;
margin: auto;
text-align: center;
vertical-align: middle;
}
#rcorners {
border-radius: 15px;
border: 6px solid #ffffff;
padding: 20px;
/* width: 450px;
height: 40px; */
}
body {
background-image: url(images/blaunew.png);
background-color: #001b33;
color: #ffffff;
font-family: 'Roboto';font-size: 14px;
}
#rcorners {
font-family: 'Roboto';font-size:48px;font-weight:700; font-style:normal; Helvetica, sans-serif;
}
p {
font-family: 'Roboto'; font-size: 32px; Helvetica, sans-serif;
}
.main {
margin-top: 20%;
//font-size: 35px;
}
footer {
font-size: 14px;
}
<div id="wrapper">
<div class="main">
<h1 id="rcorners">Centered Text No1</h1>
<p>LOREM IPSUM DOLOR </p>
</div>
<footer>
<div>© Lorem Ipsum Dolor </div>
</footer>
</div>
To center the button add margin: 0 auto and to center the text you can easily do it with flexbox I think. The code will look something like:
#rcorners {
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto;
}
You can read more about centering with flexbox here: https://philipwalton.github.io/solved-by-flexbox/demos/vertical-centering/
I have edit your CSS. but i dont get why you gave height on your #rcorners element. Hope this will help you
CSS
#wrapper {
position: relative;
width: 80%;
margin: auto;
text-align: center;
vertical-align: middle;
}
#rcorners {
border-radius: 15px;
border: 6px solid #ffffff;
padding: 20px;
width: 450px;
/*height: 40px; */ /*it is less height for 2 line text*/
}
body {
background-image: url(images/blaunew.png);
background-color: #001b33;
color: #ffffff;
font-family: 'Roboto';font-size: 14px;
}
#rcorners {
font-family: 'Roboto';font-size:48px;font-weight:700; font-style:normal; Helvetica, sans-serif;
}
p {
font-family: 'Roboto'; font-size: 32px; Helvetica, sans-serif;
}
.main {
margin-top: 20%;
margin-left: auto;
margin-right: auto;
display: inline-block;
width: auto;
/*font-size: 35px; */
}
footer {
font-size: 14px;
}
Somehow one of the group of the same block elements on the picture gets inexplicably big height. Styles shown on the pic don't suggest that kind of behavior for this element. In fact, height isn't even set for those h3's.
Browser screenshot
The html is
<section class="about-us">
<div class="wrapper clearfix">
<h2 class="about-us-heading section-heading red-black-stressing-line-at-left">About Us</h2>
<p class="about-us-statement section-saying about-us-saying">This is who we are - or at least who we strive to be...</p>
<div class="about-more">
<p class="about-saying">If you can't explain it simply, you don't understand it enough.</p>
The more you know
</div>
<div class="about-work-details">
<h3 class="about-details-heading typography-icon">Typography</h3>
<p class="about-details-text">...</p>
</div>
<div class="about-work-details">
<h3 class="about-details-heading curve-with-dots-icon">Full icon set</h3>
<p class="about-details-text">...</p>
</div>
<div class="about-work-details">
<h3 class="about-details-heading triangular-ruler-icon">Accurate</h3>
<p class="about-details-text">...</p>
</div>
</div>
</section>
Three same div.about-work-details elements.
The default css is
.about-us{
background-color: #fff;
position: relative;
}
.about-us-heading{
color: #272d32;
}
.about-us-statement{
color: #4e5860;
margin-bottom: 3.9em;
}
.about-more{
width: 16.875em;
float:left;
margin-right: 1.875em;
}
.about-saying{
font-family: "Open Sans", sans-serif;
font-size: 1.75em;
line-height: 1.4285;
color: #4e5860;
}
.about-more-link{
display: inline-block;
font-family: "Raleway", sans-serif;
line-height: .77;
padding: 1em 2.625em 1em 1.25em;
text-decoration: none;
font-weight: 600;
color: #fff;
text-transform: uppercase;
background: #ff3c1f url(../images/left-arrow.gif) 12.7em .95em no-repeat;
margin-top: 4.25em;
transition: background-color 0.5s;
}
.about-work-details{
width: 16.875em;
float:left;
margin-right: 1.685em;
margin-bottom: 8.1875em;
position: relative;
min-height: 16.875em;
border: 1px solid #edeff2;
}
.about-work-details:last-of-type{
margin-right: 0;
}
.about-details-heading{
font-family: "Open Sans", sans-serif;
font-weight: 700;
font-size: 1.25em;
color: #303030;
text-transform: uppercase;
padding: 0.85em 0 1em 3em;
margin: 1.70em 0 0 1em;
}
Media query modifications
#media screen and (max-width: 860px){
.about-work-details{
width: 70%;
margin: 3em auto;
min-height: 0;
float: none;
}
.about-us{
padding-bottom: 1px;
}
.about-work-details:last-of-type {
margin-right: auto;
}
}
Seems like a floating item behavior issue.
Try removing/commenting float:left; from .about-more.
Hi I'm building an app on the Salesforce1 platform and I'm having some trouble with the UI. If you look at the recent and popular ideas columns, technically they are side by side but the Recent Ideas column is slightly lower than the Popular Ideas column and I can't figure out how to get them exactly side by side again. Any help would be greatly appreciated.
HTML (ignore the apex tags. Indentation is a bit messed up because of how I had to format it to put it in a code block for this post)
<apex:page standardcontroller="Idea" recordSetVar="idea"
sidebar="false"
showHeader="false"
standardstylesheets="false"
doctype="html-5.0">
<head> </head>
<body>
<apex:stylesheet value="{!$Resource.PuroIdeas_Homepage_CSS}" />
<div id="header">
<a href="https://cs3.salesforce.com/apex/PuroIdeas_Home">
<img id="PuroIdeasLogo" src="{!$Resource.PuroIdeasLogo}"/>
</a>
<br/>
<p id="introCopy" >PuroIdeas is a place where you can innovate. Share your ideas, check out others, join the discussion and help build a better Purolator</p>
</div>
<div id="login">
<p class="loginText"> Login | Sign Up </p>
</div>
<div id="Challenges">
<h1 class="ChallengesHeader"> Challenges </h1>
<div class="activeChallenge">
<!-- <apex:dataList value="{!ideatheme}" var="i" id="list">
{!i.title}
</apex:dataList>
<apex:pageblock>
<apex:outputField value="{!idea.title}" />
</apex:pageblock> -->
<p> CHALLENGE 1 - </p>
</div>
<div class="activeChallenge">
<p> CHALLENGE 2 - </p>
</div>
<div class="activeChallenge">
<p> CHALLENGE 3 - </p>
</div>
<!-- Do I need a div for the view all button? -->
</div>
<div id="rpIdeasContainer">
<div id="recentIdeas">
<h1 class="RecentIdeasHeader"> Recent Ideas </h1>
<div class="rIdeas"> Recent Idea 1</div>
<div class="rIdeas"> Recent Idea 2</div>
<div class="rIdeas"> Recent Idea 3</div>
</div>
<div id="popularIdeas">
<h1 class="PopularIdeasHeader"> Popular Ideas </h1>
<div class="pIdeas"> Popular Idea 1</div>
<div class="pIdeas"> Popular Idea 2</div>
<div class="pIdeas"> Popular Idea 3</div>
</div>
</div>
<div id="generalFeedback">
<h1 class="GeneralFeedbackHeader">General Feedback</h1>
<p>Category <br/> Title <br/> Description</p>
<apex:form >
<!-- <apex:inputField ></apex:inputField> -->
<!-- <apex:commandButton action="{!submit}" value="Submit"/> -->
</apex:form>
</div>
<div id="pastChallenges">
<h1 class="PastChallengesHeader">Past Challenges</h1>
<div class="pChallenge"> Past Challenges 1</div>
<div class="pChallenge"> Past Challenges 2</div>
<div class="pChallenge"> Past Challenges 3</div>
</div>
<div id="ideasInAction">
<h1 class="IdeasInActionHeader">Ideas In Action</h1>
<div class="IIA"> Idea in Action 1</div>
<div class="IIA"> Idea in Action 2</div>
<div class="IIA"> Idea in Action 3</div>
</div>
</body>
</apex:page>
CSS
#header
{
width: 70%;
border-bottom-style: solid;
border-color: #D1D1D1;
border-width: 2px;
margin-left: auto;
margin-right: auto;
}
#PuroIdeasLogo
{
display: block;
margin-left: auto;
margin-right: auto;
}
#introCopy
{
text-align: center;
font-family: "Segoe UI"; /*Helvetica, Arial;*/
font-weight: lighter;
max-width: 60%;
margin-left: auto;
margin-right: auto;
color: #575757;
}
#login
{
width: 70%;
/*border-bottom-style: solid;
border-color: #D1D1D1;
border-width: 1px;*/
margin-left: auto;
margin-right: auto;
}
.loginText
{
text-align: center;
font-family: "Segoe UI", Helvetica, Arial;
font-weight: lighter;
}
#Challenges
{
width: 70%;
border-bottom-style: solid;
border-color: #D1D1D1;
border-width: 1px;
margin-left: auto;
margin-right: auto;
}
.ChallengesHeader
{
padding-left: 40px;
font-family: "Segoe UI";
font-weight: lighter;
color: #575757;
}
.activeChallenge
{
width: 90%;
margin: 20px auto;
padding: 15px;
font-family: "Segoe UI";
font-weight: lighter;
color: #2071FE;
/*background-color: #2071FE;*/
border: 2px solid #2071FE;
border-radius: 15px;
}
#rpIdeasContainer
{
width: 70%;
margin-left: auto;
margin-right: auto;
border-bottom-style: solid;
border-width: 1px;
border-color:#D1D1D1;
}
#recentIdeas
{
width: 50%;
margin-left: auto;
margin-right: auto;
float:left;
}
.RecentIdeasHeader
{
padding-left: 40px;
font-family: "Segoe UI";
font-weight: lighter;
color: #575757;
}
.rIdeas
{
width: 85%;
margin: 20px auto;
border: 1px solid red;
font-family: "Segoe UI", Helvetica, Arial;
font-weight: lighter;
color: #ADADAD;
}
#popularIdeas
{
margin-left: 50%;
margin-right: auto;
}
.PopularIdeasHeader
{
padding-left: 40px;
font-family: "Segoe UI";
font-weight: lighter;
color: #575757;
}
.pIdeas
{
width: 85%;
margin: 20px auto;
border: 1px solid red;
font-family: "Segoe UI", Helvetica, Arial;
font-weight: lighter;
color: #ADADAD;
}
#generalFeedback
{
width: 70%;
margin-top: 10px;
margin-left: auto;
margin-right: auto;
font-family: "Segoe UI", Helvetica, Arial;
font-weight: lighter;
color: #ADADAD;
}
.GeneralFeedbackHeader
{
padding-left: 40px;
font-family: "Segoe UI";
font-weight: lighter;
color: #575757;
}
#pastChallenges
{
width: 70%;
border-style: dotted;
margin-left: auto;
margin-right: auto;
}
.PastChallengesHeader
{
padding-left: 40px;
font-family: "Segoe UI";
font-weight: lighter;
color: #575757;
}
.pChallenge
{
font-family: "Segoe UI", Helvetica, Arial;
font-weight: lighter;
color: #ADADAD;
}
#ideasInAction
{
width: 70%;
border-style: dotted;
margin-left: auto;
margin-right: auto;
}
.IdeasInActionHeader
{
padding-left: 40px;
font-family: "Segoe UI";
font-weight: lighter;
color: #575757;
}
.IIA
{
font-family: "Segoe UI", Helvetica, Arial;
font-weight: lighter;
color: #ADADAD;
}
try to add this in the popular idea div
#popularIdeas
{
vertical-align:middle;
}
or
vertical-align:top;
what's happening?
if thats not working you can just use
display: inline-block
on both div (popular ideas and recent ideas)
I would suggest something different for the same, You can use display property instead of float property. You might have to do some changes like following
#recentIdeas {
width: 50%;
margin-left: auto;
margin-right: auto;
/* float: left; */ /* Removed this */
vertical-align: top; /* Added this */
display: inline-block; /* Added this */
}
#popularIdeas
{
/*margin-left: 50%;*/ /* Removed this */
margin-right: auto;
display:inline-block; /* Added this */
vertical-align:top /* Added this */
}
Demo
I would modify the following classes as such:
#recentIdeas {
width: 48%;
background-color: #FFA500;
padding: 0px !important;
margin: 0px !important;
display: inline-block;
}
#popularIdeas {
width: 48%;
background-color: #AFA500;
padding: 0px !important;
margin: 0px !important;
display: inline-block;
}
You can see this here-> http://jsfiddle.net/T2GG4/
Hope this helps!!!