How to make page with image and text in header responsive? - css

I have a razor page with a header. The header is a component PageHeader.razor.
And I try it to make responsive. But when I show it in the responsive mode the text and image are overlapping eachother.
What do I wrong?
The page with the header:
<div class="row myheader">
#{
string title = "This is a title";
string subtitle = "This is a subtitle";
<PageHeader Title=#title Subtitle=#subtitle />
}
</div>
... and the header:
<div class="d-flex align-items-center">
<div class="col-2 me-0">
#{
string url = $"/images/trofee.png";
<img src=#url class="rounded float-start image-responsive" height="256" width="256" />
}
</div>
<div class="col-10 ms-0 rounded mb-3 align-self-end text-start">
<div class="row mytitleheader">
<h2><span>#Title</span></h2>
</div>
<div class="row mysubtitleheader">
<span>#Subtitle</span>
</div>
</div>
</div>
#code {
[Parameter] public string Title { get; set; } = string.Empty;
[Parameter] public string Subtitle { get; set; } = string.Empty;
[Parameter] public string ImageType { get; set; } = string.Empty;
}
... and the css:
.myheader {
background: -webkit-linear-gradient(left, yellow, orange); /* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(right, yellow, orange); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(right, yellow, orange); /* For Firefox 3.6 to 15 */
background: linear-gradient(to right, yellow, orange); /* Standard syntax (must be last) */
box-shadow: 10px 10px 5px black;
margin: 4px 7px 25px 4px;
}
.mytitleheader {
color: red;
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
font-weight: bolder;
font-style: italic;
}
.mysubtitleheader {
font-style: italic;
color: blue;
font-size: 1.5rem;
}
Examples from the small and larges view:
and:

It because you set col-2 for img parent and it sets width:16.666%. Just delete it if you want img parent to be 256x256.
<div class="me-0">
#{
string url = $"/images/trofee.png";
<img src=#url class="rounded float-start image-responsive" height="256" width="256" />
}
</div>

Related

Is it possible to keep the port view and container automatically adjusting?

I want to build a data dashboard and want the whole page filled with cards. I have only 6 cards. Is it possible to get rid of the space (see red area)
So when resizing the screen the viewport and the container automatically adjust itself, as soon as the viewport takes up an fr space is filled with cards
//Bar chart
let myChart = document.getElementById('myChart').getContext('2d');
//Global Options
Chart.defaults.global.defaultFontFamily = 'Raleway, sans-serif, Arial, Helvetica, AlvaroCondensed';
Chart.defaults.global.defaultFontSize = 11.2;
Chart.defaults.global.defaultFontColor = '#695771';
//How to edit font type (thicker)on x/y axes or disable 90, 80, 70 ... on bar chart? Chart.defaults.global.defaultFontColor = '#F9EDF8';
let massPopChart = new Chart (myChart, {
type: 'bar',
data: {
labels: ['creati', 'inz', 'inspi', 'vooru', 'vast', 'altru'],
datasets: [{
label: 'Punten',
data: [90, 60, 40, 29, 79, 55
],
backgroundColor: ['#F9EDF8', '#DDC3DA', '#BE9DBB', '#D4ADCE', '#F9EDF8', '#DDC3DA', '#BE9DBB' ],
borderWidth: 1,
borderColor: '#A283A1',
hoverBorderWidth: 1,
hoverBorderColor: '#695771'
}]
},
//Targeting different sections adding Title
options: {
legend: {
display: false
}
},
layout: {//move the chart to left, right etc
padding: {
left: 50,
right: 0,
bottom: 0,
top:0
}
},
tooltips: {// todo: reduce size of the tooltips
enabled: true
}
});
//Radar chart
let myChart1 = document.getElementById('myChart1').getContext('2d');
//Global Options
Chart.defaults.global.defaultFontFamily = 'Raleway, sans-serif, Arial, Helvetica, AlvaroCondensed';
Chart.defaults.global.defaultFontSize = 11.2;
Chart.defaults.global.defaultFontColor = '#695771';
let massPopChart1 = new Chart (myChart1, {
type: 'radar',
data: {
labels: ['creati', 'inz', 'inspi', 'vooru', 'vast', 'altru'],
datasets: [{
label: 'Punten',
data: [90, 60, 40, 29, 79, 55
],
backgroundColor: ['#F9EDF8', '#DDC3DA', '#BE9DBB', '#D4ADCE', '#F9EDF8', '#DDC3DA', '#BE9DBB'],
borderWidth: 1,
borderColor: '#A283A1',
hoverBorderWidth: 1,
hoverBorderColor: '#695771'
}]
},
//Targeting different sections adding Title
options: {
legend: {
display: false
}
},
});
//Polar area chart
let myChart2 = document.getElementById('myChart2').getContext('2d');
//Global Options
Chart.defaults.global.defaultFontFamily = 'Raleway, sans-serif, Arial, Helvetica, AlvaroCondensed';
Chart.defaults.global.defaultFontSize = 11.2;
Chart.defaults.global.defaultFontColor = '#695771';
let massPopChart2 = new Chart (myChart2, {
type: 'polarArea',
data: {
labels: ['creati', 'inz', 'inspi', 'vooru', 'vast', 'altru'],
datasets: [{
label: 'Punten',
data: [90, 60, 40, 29, 79, 55
],
backgroundColor: ['#F9EDF8', '#DDC3DA', '#BE9DBB', '#D4ADCE', '#F9EDF8', '#DDC3DA', '#BE9DBB'],
borderWidth: 1,
borderColor: '#A283A1',
hoverBorderWidth: 1,
hoverBorderColor: '#695771'
}]
},
//Targeting different sections adding Title
options: {
legend: {
display: true
}
},
});
// Horizonal bar
//Main chart
let myChart3 = document.getElementById('myChart3').getContext('2d');
//Global Options
Chart.defaults.global.defaultFontFamily = 'Raleway, sans-serif, Arial, Helvetica, AlvaroCondensed';
Chart.defaults.global.defaultFontSize = 11.2;
Chart.defaults.global.defaultFontColor = '#695771';
let massPopChart3 = new Chart(myChart3, {
type: 'horizontalBar',
data: {
labels: ['creati', 'inz', 'inspi', 'vooru', 'vast', 'altru'],
datasets: [{
label: 'Punten',
data: [90, 60, 40, 29, 79, 55
],
backgroundColor: ['#F9EDF8', '#DDC3DA', '#BE9DBB', '#D4ADCE', '#F9EDF8', '#DDC3DA', '#BE9DBB'],
borderWidth: 1,
borderColor: '#A283A1',
hoverBorderWidth: 1,
hoverBorderColor: '#695771'
}]
},
//Targeting different sections adding Title
options: {
legend: {
display: false
}
},
});
#font-face {
font-family: AlvaroCondensed;
src: url("AlvaroCondensed.woff") format("woff"), url("AlvaroCondensed.ttf") format("truetype");
}
#font-face {
font-family: AlvaroCondensed;
src: url("webfont.eot"); /* IE9 Compat Modes */
src: url("webfont.eot?#iefix") format("embedded-opentype"), /* IE6-IE8 */
url("webfont.woff") format("woff"), /* Modern Browsers */
url("webfont.ttf") format("truetype"), /* Safari, Android, iOS */
url("webfont.svg#svgFontName") format("svg"); /* Legacy iOS */
}
div {
font-family: Raleway, sans-serif, Arial, Helvetica, AlvaroCondensed;
}
html, body {width: auto!important; overflow-x: hidden!important}
body {
margin: auto 0; /*Remove prebuild browser default CSS*/
font-family: Raleway, sans-serif, Arial, Helvetica, AlvaroCondensed;
display: grid;
background-color: #d0afcf;
font-size: 0.7em; /* Default for the whole page*/
color: rgb(128, 110, 139);
}
/*.zone {
cursor: pointer;
color:#FFF;
font-size:2em;
border-radius:4px;
border:1px solid #bbb;
transition: all 0.3s linear;
}
/* HEADER */
header {
display: flexbox;
padding: 20px;
margin: 20px;
margin: 0;
}
header h1 {
font-family: Raleway,sans-serif, Arial;
text-transform: uppercase;
font-size: 2em;
/* margin-top: -0.1em;
margin-bottom: 0.1em; or line-height: default or 150% */
color: rgb(240, 221, 241);
}
.active {
font: Raleway;
font-style: italic;
/* font-size: 0.7em; */
}
hr {
border-style: dashed;
border-color:rgb(128, 110, 139);
}
h4 {
text-transform: uppercase;
}
/***********************************************************************
* COVER
**********************************************************************/
.container {
display: flex;
align-items: center;
justify-content: center;
height: auto;
/*width: 30rem;*/
padding: 20px;
margin: 20px;
}
/***********************************************************************
* GRID PANEL
**********************************************************************/
.grid-wrapper {
display: grid;
grid-column-gap: 0;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); /*Everythin is responsive, it fill 1fr when it is small*/
}
.box > canvas {
width: 100%;
padding: 60px;
margin: 20px;
}
.box {
padding: 20px;
margin: 20px;
border-width: 1px 1px 1px;
border-style: dashed;
border-color:rgb(128, 110, 139);
}
/* PARTICULAIR GRID */
.one h1 {
font-family: AlvaroCondensed;
font-size: 3em;
/*Keep the same margins in each box*/
margin-top: 0.5em;
margin-bottom: 0.5em;
text-transform: uppercase;
color: rgb(240, 221, 241);
word-break: break-word;
}
.two h1 {
font-family: AlvaroCondensed;
font-size: 3em;
margin-top: 0.5em;
margin-bottom: 0.5em;
word-break: break-word;
text-transform: uppercase;
}
ol li {
margin-bottom: -20px;
}
ol{
padding-left: 0;
margin-left: 15px;
}
/* Primary font */
.five h1 {
font-family: AlvaroCondensed;
font-size: 4em;
margin-top: 0.5em;
margin-bottom: 0.5em;
word-break: break-word;
}
/***********************************************************************
* FOOTER
**********************************************************************/
/*Sticky navigation
.sticky {
position: fixed;
top: 0;
width:100%;
}
*/
.main-nav {
display: flex;
list-style: none;
align-items: center;
justify-content: center;
margin: 0;
}
/*.push {
margin: auto;
}*/
li {
padding: 20px;
}
a {
color: rgb(240, 221, 241);
text-decoration: none;
}
#media only screen and (max-width: 600px) {
.main-nav {
font-size: 0.5em;
}
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Dashboard Layout</title>
<!-- add meta data -->
<link rel="stylesheet" type="text/css" href="./style.css">
<link rel="preload" href="AlvaroCondensed.woff" as="font" type="font/woff" crossorigin>
</head>
<body>
<header >
<h3 class="anyname active">Sub title of the dashboard</h3>
<h1>Here comes the main titel about the dashboard you're seeing here below etetra</h1>
<hr>
<h4>Here comes the titel of the main chart </h4>
</header>
<div class="container zone ">
<canvas id="myChart1"></canvas>
</div>
<div class="zone blue grid-wrapper">
<div class="box one">
<h4>Here comes titel of the box one </h4>
<h1>23953</h1>
<p>It is a long fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. </p>
</div>
<div class="box two">
<h4>Here comes title of another box, here box number three</h4>
<h1>Something</h1>
<ol>
<li>Something number one is</li>
<li>Something number two is</li>
<li>Something number three is</li>
<li>Something number four is</li>
<li>Something number five is</li>
<li>Something number six is</li>
</ol>
</div>
<div class="box three">
<h4>Here comes title of another box, here box number three </h4>
<div class="container">
<canvas id="myChart"></canvas>
</div>
<p>Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy</p>
</div>
<div class="box four">
<h4>Here comes title of another box, here box number four </h4>
<div class="container">
<canvas id="myChart3"></canvas>
</div>
<p>Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy</p>
</div>
<div class="box five">
<h4>Here comes a short titel</h4>
<h1>Here comes something</h1>
<p>Ipsum as their default model text</p>
<hr>
<h4>Here comes a short titel</h4>
<h1>Here comes something</h1>
<p>Ipsum as their default model text</p>
<hr>
</div>
<div class="box six">
<h4>Intermediairs/werkgevers met de meesta aanbod vacatures</h4>
<div class="container">
<canvas id="myChart2"></canvas>
</div>
<p>Ipsum as their default model text</p>
</div>
</div>
<footer class="zone green">
<ul class="main-nav sticky">
<li> About</li>
<li> Products</li>
<li> Out team</li>
<li class="push"> Contacts</li>
</ul></footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.js"></script>
<script src="script.js"></script>
</body>
</html>
I suggest reading about the different layout systems in CSS: https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout
Flexbox or Grid might help in your case, depending on what layout and behavior on different screen sizes you have in mind.

MaterializeCSS autocomplete edit css

I have been trying to customize a search bar that I initially created using MaterializeCSS. I am using the Autocomplete functionality in order to make searching easier. However, I have been unable to successfully change the green MaterializeCSS font colors and size, etc. Both in the input and in the dropdown that appears when people search. I would very much appreciate if someone here could help. I have tried changing the CSS in lots of ways but have been unsuccessful.
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/css/materialize.min.css">
<section id="search" class="section white-text blue section-search center scrollspy">
<div class="container">
<div class="row">
<div class="col s12">
<h3>Search destinations</h3>
<div class="input-field">
<i class="material-icons prefix">search</i>
<input type="text" class="white grey-text autocomplete" id="autocomplete-input" placeholder="Search" />
</div>
</div>
</div>
</div>
</section>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/js/materialize.min.js"></script>
CSS:
.section-search input {
padding: 5px !important;
font-size: 18px !important;
width: 90% !important;
border: #f4f4f4 3px solid !important;
background-color: red !important;
}
.section-search input .autocomplete {
color: #000 !important;
}
Javascript:
// Autocomplete
const ac = document.querySelector('.autocomplete');
M.Autocomplete.init(ac, {
data: {
"Banana": null,
"Apple": null,
"Coconut": null,
"Carrot": null,
"Pear": null,
}
});
It looks like your input element has a class of .grey-text that has a color: #9e9e9e !important; declaration which will override any color styles you add. I'd recommend removing that class (and maybe the .white class):
<input type="text" class="autocomplete" id="autocomplete-input" placeholder="Search" />
And your CSS has an extra space between input and .autocomplete (also don't need the !important anymore):
.section-search input.autocomplete {
color: #000;
}
.input-field .prefix.active {
color: #000!important;
}
.dropdown-content li>a, .dropdown-content li>span {
color: #000!important;
}
.autocomplete-content li .highlight {
color: red!important;
}
Working Example

aligning to div's next to each other - media query

I am trying to render a section of my pafe as in this following image. http://i.imgur.com/63q9Syr.jpg> I can now get it to render right in larger screens. But when I use meduia query the second box mis aligns. I appears to be a little above first box. Is there way I can fix it?
<section class="carousel price-carousel"> <!--Price section -->
<div class="container">
<div class="price-container">
<span class="month-column">
<h4>Monthly</h4>
<p>$9.95</p>
<p class=”sub-text”>per computer</p>
</span>
<span class="year-column">
<h4>Yearly</h4>
<p>$99</p>
<p class=”sub-text”>Save 20% when you pay anually</p>
</span>
</div>
</div>
</section>
Any help is much appreciated.
JSFiddle link: http://jsfiddle.net/d4gyo5s8/7/
Just delete:
margin-top:35px;
of set it to 0, in your media-query.
Also add:
vertical-align: top;
Proof:
http://jsfiddle.net/zmqoz7pv/1/
I've created a sample, check the below code and the fiddle sample!!
The HTML:
<section class="carousel price-carousel">
<div class="container">
<div class="price-container">
<span class="month-column">
<h2>Monthly</h2>
<h3>$9.95</h3>
<p class="sub-text">per computer</p>
</span>
<span class="year-column">
<h2>Yearly</h2>
<h3>$99</h3>
<p class="sub-text highlight">Save 20% when you pay anually</p>
</span>
</div>
</div>
</section>
The CSS
*, ht, h2, h3, h4, p, div, img {
margin:0;
padding:0;
}
.container {
background-color: #eee;
}
.price-container {
text-align:center;
vertical-align:top;
font-family:arial;
font-size:14px;
color:#333333;
}
.price-container span {
display:inline-block;
margin:10px;
padding-bottom:10px;
border:1px solid #676767;
width:300px;
background:#fafafa;
}
.price-container h2 {
font-size:18px;
font-weight:bold;
color:#f1f1f1;
background:#676767;
padding:5px 0;
}
.price-container h3 {
font-family:'Arial Black', Helvetica, Verdana, sans-serif;
font-size:30px;
font-weight:bold;
color:#000000;
padding:8px 0;
}
.sub-text {
font-family:arial;
font-size:16px;
}
.highlight {
color:#609347;
}
Fiddle Demo

Child Div not showing border

I have a webpage with two nested divs.
I need the inside div to show its border, however it is not. I have tryed every suggestion I have come across, but no avail.
while trying different solutions, I have noticed that the parent div does show its border without much hassle. What am I doing wrong?
css
.contentItemsWrapper
{
margin:auto;
width: 900px ;
margin-left: auto ;
margin-right: auto ;
text-align:center;
padding-top:20px;
padding-bottom:20px;
border:solid red;
border-width:5px 0;
/*this div's border is showing up fine.*/
}
.contentEventItem {
font-family: Georgia, "Times New Roman", Times, serif;
font-style: normal;
font-weight: normal;
position: relative;
border:solid red;
border-width:5px 0;
/* this last one is not working*/
}
HTLM:
<div class="contentItemsWrapper">
<div class="contentEventItem style=" border:solid="" red;="" border-width:5px="" 0;="" "="" id="evento1">
<div class="DataIncontro" id="dataIncontro1">
<span class="month">Decembre</span>
<span class="number">26</span>
<span class="time">15:00</span>
<span class="day">Gio</span>
</div>
<div class="logoSquadra"><span class="helper"></span><img name="" src="images/logo_nbb.png" alt="" style="background-color: #003399"></div>
<div class="nameEventLocation" id="nameEventLocation1">
<strong class="eventname">New Basket Brindisi - Cremonese</strong>
<span class="location">Nome Stadio</span>
</div>
<div class="logoSquadra"><img name="" src="images/logo_nbb.png" alt="" style="background-color: #003399"></div>
<div class="noteEvento">Aquistabili online fino al xx dicemnre, ore 20.00</div>
<div class="buttonDiv">
<p>
<a class="multi-line-button green" href="#" style="width:14em">
<span class="title">Compra Ora!</span>
<span class="subtitle">30-days free!</span>
</a>
</p>
</div>
</div>
</div>
What am I doing wrong? Can somebody please help me?
Thank you very much in advance for your time.
Im confused, you want this?
CSS:
.contentEventItem {
font-family: Georgia, "Times New Roman", Times, serif;
font-style: normal;
font-weight: normal;
position: relative;
border: 1px solid #000;
/* this last one is now working*/
}
All I have done is add border: 1px solid #000; and deleted this odd HTML:
border:solid="" red;="" border-width:5px="" 0;="" "=""
DEMO HERE
border-width:5px 0;
There is no shorthand for more than one border position. Try this instead.
border-bottom: 5px solid red;
border-top: 5px solid red;
border-left:none;
border-right:none;

trouble aligning div side by side

I'm trying to get the shoutbox on www.talkjesus.com (vBulletin forum) to float left while the verse of the day (orange) to float on the very right side of the shoutbox. I've tried so many variations but it's not working, I'm stuck. Your help appreciated.
The forumhome template code I'm using now is:
<div class="blockbody formcontrols floatcontainer">
<div id="wgo_onlineusers" class="wgo_subblock">
<h3 class="blocksubhead" style="background-color:#82BA1B; color: #fff !important; font-size: 22px; font-weight: 300">shoutbox</h3>
<div style="text-align: center; line-height: 0" class="blockrow">
<div><iframe frameborder="0" width="100%" height="200" src="http://www.cbox.ws/box/?boxid=439&boxtag=7868&sec=main" marginheight="2" marginwidth="2" scrolling="auto" allowtransparency="yes" name="cboxmain1-439"" id="cboxmain1-439" style="border-bottom: 1px solid #e4e4e4;"></iframe></div>
<div style="position:relative"><iframe frameborder="0" width="350" height="70" src="http://www.cbox.ws/box/?boxid=439&boxtag=7868&sec=form&nme={vb:raw cboxnme}&nmekey={vb:raw cboxkey}&pic={vb:raw cboxav}&lnk={vb:raw cboxav}" marginheight="2" marginwidth="2" scrolling="no" allowtransparency="yes" name="cboxform1-439" id="cboxform1-439"></iframe></div>
</div>
</div>
</div>
<br />
<div class="blockbody formcontrols floatcontainer">
<div id="wgo_onlineusers" class="wgo_subblock">
<h3 class="blocksubhead" style="background-color:#E66B1B; color: #fff !important; font-size: 22px; font-weight: 300">verse of the day</h3>
<div>
<div style="font-size:16px; line-height:28px; padding:10px; color: #797979">
<script type="text/javascript" src="http://www.christnotes.org/syndicate.php?content=dbv&type=js2&tw=auto&tbg=ffffff&bw=0&bc=000000&ta=L&tc=43A6DF&tf=Open Sans&ts=14&ty=B&va=L&vc=43A6DF&vf=Open Sans&vs=12&tt=3&trn=NASB"></script>
</div>
</div>
</div>
</div>
relevant CSS code...
/* Auto-clearing of floats */
.floatcontainer:after,
.formcontrols .blockrow:after,
dl.stats:after {
content:".";
display:block;
height:0;
clear:both;
visibility:hidden;
}
.floatcontainer,
.formcontrols .blockrow,
dl.stats {
display:inline-block;
font-weight:normal;
}
/* IE-Mac hide \*/
* html .floatcontainer,
.formcontrols .blockrow,
dl.stats {
height:1%;
}
.floatcontainer,
.formcontrols .blockrow,
dl.stats {
display:block;
}
.blockrow {
padding:12px;
}
.blocksubhead {
padding:12px;
}
.blockhead_info, .blocksubhead_info {
float:right;
font-weight:normal;
}
Have you tried applying the float property to the .floatcontainer element?
.floatcontainer {
width: 50%;
float: left;
}
Setting the width property will be necessary here because the output of the script in the second .floatcontainer block adds a div element to the document which has a width of 100%. Take a look at the output here: http://goo.gl/Bw7iaD (see inline styles of first element). This makes the verse box span full-width unless it's parent container has a specified width.
Here is an example of the working code: http://cdpn.io/0dfce502ffdc99f54a159f7a563ed4fe

Resources