Image resize for different screens - asp.net

Hello All,
Above picture shows a series of images and corresponding link text. Requirment is that I need to get shrink off images and also text so that they should appear in same line in different screen resolutions...
I have used vw as font specification for font resize. But unable to get image resized using the below css...
.bannerimage {
max-width: 100%;
height: auto;
width: auto/9;/* ie8 */
overflow:hidden;
}
Design code for the ribbon is as follows:
<div style="padding-left: 50px; padding-top: 20px; height: 110px; width: 100%">
<div>
<div style="float: left">
<div style="float: left;">
<asp:ImageButton runat="server" ImageUrl="~/Images/Go_to_icon.png" CssClass="footerimage" style="min-height:30px;min-width:30px" />
</div>
<div style="top: 15px; position: relative; float: left; width: 180px">
<div class="footerlinkdiv">
<asp:LinkButton ID="LinkButton9" runat="server" CssClass="footerlink" Text="Go To Administration Page" Style="text-align: start"></asp:LinkButton>
</div>
</div>
<div class="footerseprator">
</div>
</div>
<div style="float: left">
<div style="float: left; padding-left: 20px">
<asp:ImageButton ID="ImageButton8" runat="server" ImageUrl="~/Images/Go_to_icon.png" CssClass="footerimage" />
</div>
<div style="top: 15px; position: relative; float: left; width: 180px">
<div class="footerlinkdiv">
<asp:LinkButton ID="LinkButton10" runat="server" CssClass="footerlink" Text="Go To Authorize US Partners" Style="text-align: start"></asp:LinkButton>
</div>
</div>
<div class="footerseprator">
</div>
</div>
<div style="float: left">
<div style="float: left; padding-left: 20px">
<asp:ImageButton ID="ImageButton9" runat="server" ImageUrl="~/Images/Go_to_icon.png" CssClass="footerimage" />
</div>
<div style="top: 15px; position: relative; float: left; width: 180px">
<div class="footerlinkdiv">
<asp:LinkButton ID="LinkButton11" runat="server" CssClass="footerlink" Text="Go To Authorize Canada Partners" Style="text-align: start"></asp:LinkButton>
</div>
</div>
<div class="footerseprator">
</div>
</div>
<div style="float: left">
<div style="float: left; padding-left: 20px">
<asp:ImageButton ID="ImageButton10" runat="server" ImageUrl="~/Images/Go_to_icon.png" CssClass="footerimage" />
</div>
<div style="top: 15px; position: relative; float: left; width: 180px">
<div class="footerlinkdiv">
<asp:LinkButton ID="LinkButton13" runat="server" CssClass="footerlink" Text="Go To Authorize Distributor Page" Style="text-align: start"></asp:LinkButton>
</div>
</div>
</div>
</div>
</div>
tried a lot.. Could some one plz help me with css of the same for below ribbon

You will not be able to resize the text without a jquery library or css media queries. But you can resize the images by giving it some value for height or width like so:
.bannerimage {
max-width: 100%;
height: auto;
width: 10%;
overflow:hidden;
}

Related

Floating images and divs

I am trying to float one image to the right of an existing div.
The div has a background color and has text and images on top of it.
When I try to float the image to the right of the div, the image appears where the div was, and all the text and images on the div are pushed down.
Not sure why I can't get the image to appear next to the div. Here's my HTML and CSS.
#left-column-background {
width: 40%;
height: 750px;
background-color: #C16C43;
margin-left: 10%;
margin-bottom: 10%;
margin-right: 10%;
float: left;
}
#right-column-image {
background-image: url('resized-images-logo/about-resized.jpg');
background-repeat: no-repeat;
background-size: cover;
width: 40%;
height: 750px;
float: right;
}
#about-title {
color: #C16C43;
margin-top: 7%;
margin-bottom: 5%;
margin-left: 10%;
margin-right: 2%;
}
#mission-text {
margin-top: 5%;
margin-left: 12%;
margin-bottom: 5%;
width: 80%;
float: left;
}
#mission-button-large {
margin-top: 7%;
margin-left: 12%;
float: left;
}
#service-button-large {
margin-top: 12%;
margin-left: 12%;
}
#service-text {
margin-top: 5%;
margin-bottom: 5%;
margin-left: 12%;
width: 80%;
}
#values-button-large {
margin-top: 7%;
margin-left: 12%;
}
#values-button-text {
margin-top: 5%;
margin-bottom: 5%;
margin-left: 12%;
width: 80%;
}
#mission-button-medium {
display: none;
margin-top: 7%;
margin-left: 12%;
float: left;
}
#service-button-medium {
display: none;
margin-top: 12%;
margin-left: 12%;
}
#service-button-small {
margin-top: 12%;
margin-left: 12%;
display: none;
}
#values-button-medium {
margin-top: 7%;
margin-left: 12%;
display: none;
}
#mission-button-small {
margin-top: 7%;
margin-left: 12%;
float: left;
display: none;
}
#values-button-small {
margin-top: 7%;
margin-left: 12%;
display: none;
}
<div class="wrapper">
<header>
<div id="logo">
<img src="resized-images-logo/logo-use.svg" alt="moby-dick-title" />
</div>
<!--end logo and title-->
<div id="hamburger-nav-large">
<a href="#mobile-footer-nav"><img src="icons-use/hamburger-menu-
large.png" alt="hamburger menu" /></a>
</div>
<!--end of hamburger-nav-large-->
<div id="hamburger-nav-small">
<a href="#mobile-footer-nav"><img src="icons-use/hamburger-menu-
small.png" alt="hamburger menu" /></a>
</div>
<!--end of hamburger-nav-small-->
<div id="hamburger-nav-tiny">
<a href="#mobile-footer-nav"><img src="icons-use/hamburger-menu-
tiny.png" alt="hamburger menu" /></a>
</div>
<!--end hamburger-nav-tiny-->
<div id="nav">
<ul>
<li>Whaling</li>
<li>Planning</li>
<li>About</li>
<li>Contact</li>
<li>Book Trip</li>
</ul>
</div>
<!--end of nav-->
</header>
<!--end of header-->
<main>
<div id="about-title">
<h2>About Us</h2>
</div>
<!--end of about-
title-->
<div id="left-column-background">
<div id="right-column-image"></div>
<!--end right-column-image-->
<div id="mission-button-large"><img src="resized-images-
logo/mission-button-large.svg" />
</div>
<!--end mission-button-large-->
<div id="mission-button-medium"><img src="resized-images-
logo/mission-button-medium.svg" />
</div>
<!--end mission-button-medium-->
<div id="mission-button-small"><img src="resized-images-
logo/mission-button-small.svg" />
</div>
<!--end mission-button-small-->
<div id="mission-text">We were established with one goal in mind, to provide the best whale watching experience to our customers. We are comprised of a team of passionate marine biologists eager to share our experiences and knowledge. </div>
<!--end mission-text-->
<div id="service-button-large"><img src="resized-images-
logo/service-button-large.svg" /></div>
<!--end service-button-large-->
<div id="service-button-medium"><img src="resized-images-
logo/service-button-medium.svg" /></div>
<!--end service-button-medium-->
<div id="service-button-small"><img src="resized-images-
logo/service-button-small.svg" /></div>
<!--end service-button-small-->
<div id="service-text">
Our service mantra is to give you the knowledge to truly enjoy the whale watching experience. Through reading material, video, live talks and demonstrations, we provide plenty of time to ask questions and explain what you are seeing.
</div>
<!--end service-text-->
<div id="values-button-large">
<img src="resized-images-logo/values-button-large.svg" />
</div>
<!--end values-button-large-->
<div id="values-button-medium">
<img src="resized-images-logo/values-button-medium.svg" />
</div>
<!--end values-button-medium-->
<div id="values-button-small">
<img src="resized-images-logo/values-button-small.svg" />
</div>
<!--end values-button-small-->
<div id="values-button-text">
All the folks at Moby-Dick Whaling Adventures are active environmentalists. We have experience documenting many of the challenges our planet faces. We feel that the best way to save our planet is to show it off.
</div>
<!--end values-button-text-->
</div>
<!--end left-column-background-->
<div class="clearfix"></div>
<!--end clearfix-->
</main>
<!--end of main-->
<div id="mobile-footer-nav">
<ul>
<li>Whaling</li>
<li>Planning</li>
<li>About</li>
<li>Contact</li>
<li>Book Trip</li>
</ul>
</div>
<!--end of mobile-footer-nav-->
<footer>
<div id="left-column-footer">
<p>Moby-Dick Whaling Adventures</p>
<table>
<tr>
<td><img src="icons-use/phone.svg" alt="phone-icon" /></td>
<td>888-888-8888</td>
</tr>
<tr>
<td><img src="icons-use/67-email.svg" alt="email-icon" />
</td>
<td>info#mobydick.com</td>
</tr>
</table>
<p>123 Whaling Ave<br/> Whaleport, MA 02934</p>
</div>
<!--end left-column-->
<div id="center-column-footer">
<p>Comprehensive, professional tours. Custom tailored to create maximum excitement.
</p>
</div>
<!--end of center-column-->
<div id="right-column-footer">
<div id="social-icons">
<img src="icons-use/instagram-white.svg" alt="instagram-icon" />
<img src="icons-use/06-facebook.svg" alt="facebook-icon" />
<img src="icons-use/twitter.svg" alt="twitter-icon" />
</div>
<!--end social-icons-->
<div id="small-social-icons">
<img src="icons-use/instagram-white-small.svg" alt="instagram-
icon" />
<img src="icons-use/06-facebook-small.svg" alt="facebook-
icon" />
<img src="icons-use/twitter-small.svg" alt="twitter-icon" />
</div>
<!--end small-social-icons-->
<div id="copyright-text">
<p>© 2017 Moby-Dick Whaling Adventures</p>
</div>
<!--end of copyright-text-icons-->
</div>
<!--end right-column-->
<div class="clearfix"></div>
</footer>
<!--end of footer text-->
</div>
<!--end of wrapper-->

Align img right, make page scrollable if window-width is too small

I have an img which I want to align at the top right corner. If the window is too small, I don't want the image to overlap the text, but make the window scrollable. So I've made a div width max-width: 1000px;.
This is what I have now
<div style="z-index: -1; width:100%; position: absolute;">
<div style="width: auto; min-width: 1000px; display:inline-block;"></div>
<div style="display:inline-block; float: right;">
<a href="#" id="a_logo_hoek">
<img src="xx.jpg" style="float: right; margin-top:-30px;" />
</a>
</div>
</div>
How about something like this:
<div style="width: 100%; min-width: 1000px; display:inline-block;">
<div style="display:inline-block; float: right;">
<a href="#" id="a_logo_hoek">
<img src="xxx.jpg" style="float: right; margin-top:-30px;" />
</a>
</div>
</div>
Set the div that contains your img to have a min-width of 1000px and a width of 100%.
to make window scrollable use overflow:auto; in that div which contains all of your page elements.
to position the image at top right use position: absolute ; top: 0; right: 0;
and now you dont need to use min-width: 1000px;
here is your code::
<div style="z-index: -1; width:100%; overflow:auto;">
<div style="width: auto;display:inline-block;"></div>
<div style="display:inline-block; position: absolute ; top: 0; right: 0;">
<a href="#" id="a_logo_hoek">
<img src="xx.jpg" style="float: right; margin-top:-30px;" />
</a>
</div>
</div>

Boxes and Labels Not Aligned CSS

Based on this answer StackOverflow #Nikita Rybak I have created a set of labels and textboxes following his solution which shows to be working on JSFiddle.
I have copied this and added a few more categories to my ASP project but when loaded into chrome the boxes and text are all out of align.
This is my html file
<div id="User">
<div>
<div class="left">
<asp:Label ID="lbl_UserName" runat="server" Text="User Name"></asp:Label>
</div>
<div class="right">
<asp:TextBox ID="txtbx_UserName" runat="server"></asp:TextBox>
<br />
</div>
</div>
<div>
<div class="left">
<asp:Label ID="lbl_FirstName" runat="server" Text="First Name"></asp:Label>
</div>
<div class="right">
<asp:TextBox ID="txtbx_FirstName" runat="server"></asp:TextBox>
</div>
</div>
<div>
<div class="left">
<asp:Label ID="lbl_Password" runat="server" Text="Password"></asp:Label>
</div>
<div class="right">
<asp:TextBox ID="txtbx_Password" runat="server"></asp:TextBox>
</div>
</div>
<div>
<div class="left">
<asp:Label ID="lbl_ConfPassword" runat="server" Text="Confirm Password"></asp:Label>
</div>
<div class="right">
<asp:TextBox ID="txtbx_ConfPassword" runat="server"></asp:TextBox>
</div>
</div>
</div>
and my CSS file
#Content
{
position: relative;
float:none;
border: 1px solid #000000;
float: left;
padding: 80px 40px 60px 40px;
text-align:center;
background-color: #F8F8F8;
left: 0px; right: 0px;
text-align: center;
}
#User .left {
width: 30%;
float: left;
text-align: right;}
#User .right {
width: 65%;
margin-left: 10px;
float:left;}
Is there a reason why mine does not work?
It should work okay, though you have a few too many divs in there unnecessarily, and you also have a line break that may be screwing things up. Check out this fiddle
HTML
<div id="User">
<div class="left">
<label>User name</label>
</div>
<div class="right">
<input type="text" />
</div>
<div class="left">
<label>First name</label>
</div>
<div class="right">
<input type="text" />
</div>
<div class="left">
<label>Password</label>
</div>
<div class="right">
<input type="text" />
</div>
<div class="left">
<label>Confirm password</label>
</div>
<div class="right">
<input type="text" />
</div>
</div>​​​​​​​​​​​​
CSS
#User .left {
width: 30%;
float: left;
text-align: right;}
#User .right {
width: 65%;
margin-left: 10px;
float:left;}​
Also, you have a #Content element defined in your CSS nut it is not in the HTML, so that could be causing the problem.
EDIT
The only other thing I can think of is that the label control wraps the text in a - maybe try a literal control? The fiddle works fine, so it must be something with webforms controls.
Float sHould be used very carefully. Instead yo can use position attribute to position your div's accordingly.

how to align asp.net label text in center

I have a label with in a div in ASP.NET just before a text box but I am not sure how can I center align my asp.net label,
<div style="float: left; width: 65%;">
<asp:Label ID="lba" CssClass="aa" runat="server" Text="aaa" />
</div>
In the div element add style text-align: center to center the text
<div style="float: left; width: 65%; text-align: center;">
<div style="float: left; width: 65%; text-align: center;">
<asp:Label ID="lba" CssClass="aa" runat="server" Text="aaa" />
</div>
<div style="text-align:center; width:100%;">
<asp:Lable ID="lba" style="margin:0 auto;" CssClass="aa" runat="server"/>
</div>
you can also try style="margin:0 auto;" to label and width 100% to parend div.

Why are only certain divs overlapping each other?

I'm having an issue where only certain divisions are overlapping each other vertically. My second gray "pageBreak" is mounting atop my "subHeader" regardless of padding fixes and trying to staying on top of clearing floats.
I've tried overflow, clearfix, old-school "clear: both;", and I'm still having the same problem. (I assume it's a float-related issue.) I even tried (as you can see in the code) using relative and absolute positioning to get my second "pageBreak" below my "subHeader" as it should be but no positioning value even moves the second "pageBreak." I also have my other divs below these referenced sneaking up to the top of my "subHeader." I rather not use these fixes as I want the CSS to be as dynamic as possible for obvious reasons.
I feel like the code is pretty neat but I'm obviously missing something fairly obvious. Any help would be greatly appreciated!
I've included the HTML and CSS of the page for your review.
HTML:
<div class="container">
<div class="header">
<div style="float:left">
<img src="images/Logo.gif" alt="Company Logo" width="345px" height="117px">
</div>
<div style="float: right;">
<h2>Company slogan.™</h2>
</div>
<div style="clear: both;"></div>
</div>
<div class="pageBreak">
</div>
<div class="subHeader">
<div style="float: left; width: 400px; text-align: left;">
</div>
<div class="form" style="float: right; width: 300px;">
<form id='login' action='login.php' method='post' accept-charset='UTF-8'>
<input type='hidden' name='submitted' id='submitted' value='1'/>
<div>
<label style="float: left;" for='username' >School Email</label>
<input style="float: right;" type='text' name='username' id='username' maxlength="50" /></br></br>
</div>
<div style="clear: both;">
<div>
<label style="float: left;" for='password' >Password</label>
<input style="float: right;" type='password' name='password' id='password' maxlength="50" />
</div>
<div style="clear: both;"></div>
<p style="font-size: 70%; text-align: right; line-height: 8px;">Forgot your password?</p>
<p style="font-size: 70%; text-align: right; line-height: 8px;">Want to register?</p>
<div>
<input type='submit' name='Submit' value='Log In' style="float: right;"/>
</div>
</form>
</div>
<div style="clear: both;"></div>
</div>
<div class="pageBreak" style="top: 400px;">
</div>
CSS:
.container {
width: 1000px;
margin-left: auto;
margin-right: auto;
border-radius: 15px;
background-color: white;
box-shadow: 10px 10px 40px #888;
}
.pageBreak {
margin-left: auto;
margin-right: auto;
width: 900px;
border-top: rgb(238,238,238) 3px solid;
}
.header {
padding-top: 30px;
padding-bottom: 30px;
padding-left: 50px;
padding-right: 50px;
}
.subHeader {
padding-top: 30px;
padding-bottom: 30px;
padding-left: 50px;
padding-right: 50px;
}
Don't know if this will solve the issue however it is too large for a comment...
Your HTML is malformed, you are missing a few closing tags. This could be a copy error for the last tag, however the first looks to be genuine.
See code below (I have commented where the corrections are needed):
<div class="container">
<div class="header">
<div style="float:left">
<img src="images/Logo.gif" alt="Company Logo" width="345px" height="117px">
</div>
<div style="float: right;">
<h2>Company slogan.™</h2>
</div>
<div style="clear: both;">
</div>
</div>
<div class="pageBreak">
</div>
<div class="subHeader">
<div style="float: left; width: 400px; text-align: left;">
</div>
<div class="form" style="float: right; width: 300px;">
<form id='login' action='login.php' method='post' accept-charset='UTF-8'>
<input type='hidden' name='submitted' id='submitted' value='1'/>
<div>
<label style="float: left;" for='username'>School Email</label>
<input style="float: right;" type='text' name='username' id='username' maxlength="50"/></br></br>
</div>
<div style="clear: both;">
<div>
<label style="float: left;" for='password'>Password</label>
<input style="float: right;" type='password' name='password' id='password' maxlength="50"/>
</div>
<div style="clear: both;">
</div>
<p style="font-size: 70%; text-align: right; line-height: 8px;">
Forgot your password?
</p>
<p style="font-size: 70%; text-align: right; line-height: 8px;">
Want to register?
</p>
<div>
<input type='submit' name='Submit' value='Log In' style="float: right;"/>
</div>
</div> <!-- HERE -->
</form>
</div>
<div style="clear: both;">
</div>
</div>
<div class="pageBreak" style="top: 400px;">
</div>
</div> <!-- HERE -->
You have line-height: 8px in your code. increase the line-height of the paragraphs and decrease your divisions widths and omit some float properties.
see jsfiddle
Below markup will solve issues in you layout.
<!-- CONTAINER -->
<div class="container">
<!-- HEADER -->
<div class="header">
<div style="float:left"><img src="images/Logo.gif" alt="Company Logo" width="345px" height="117px"></div>
<div style="float: right;"><h2>Company slogan.™</h2></div>
<div style="clear: both;"> </div>
</div>
<!-- / HEADER -->
<!-- 1ST PAGE BREAK -->
<div class="pageBreak"> </div>
<!-- / 1ST PAGE BREAK -->
<!-- SUBHEADER -->
<div class="subHeader">
<div class="form" style="float: right; width: 300px;">
<!-- FORM -->
<form id='login' action='login.php' method='post' accept-charset='UTF-8'>
<input type='hidden' name='submitted' id='submitted' value='1'/>
<div>
<label style="float: left;" for='username' >School Email</label>
<input style="float: right;" type='text' name='username' id='username' maxlength="50" /></br></br>
</div>
<div style="clear: both;"> </div>
<div>
<label style="float: left;" for='password' >Password</label>
<input style="float: right;" type='password' name='password' id='password' maxlength="50" />
</div>
<div style="clear: both;"> </div>
<p style="font-size: 70%; text-align: right; line-height: 8px;">Forgot your password?</p>
<p style="font-size: 70%; text-align: right; line-height: 8px;">Want to register?</p>
<div><input type='submit' name='Submit' value='Log In' style="float: right;"/></div>
</form>
<!-- /FORM -->
</div>
<div style="clear: both;"> </div>
</div>
<!-- / SUBHEADER -->
<!-- 2ND PAGE BREAK -->
<div class="pageBreak"> </div>
<!-- / 2ND PAGE BREAK -->
</div>
<!-- / CONTAINER -->

Resources