The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Borders In HTML without CSS
HTMLMAL
post Apr 6 2020, 01:13 PM
Post #1





Group: Members
Posts: 4
Joined: 16-March 20
Member No.: 27,237



How can i assign border styles to the image i am using for an image map without using css? i tried using a div and it works to allign the image but not the borders ?

ex: <div style = "text-align:center;""border= 3px solid red"> <!-- the align part of the code is working but not the border-->

<img src="../webpages/pictures/image_map.png" alt="Workplace" usemap="#workmap" width="768" height="614">
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Apr 6 2020, 01:43 PM
Post #2


.
********

Group: WDG Moderators
Posts: 9,653
Joined: 10-August 06
Member No.: 7



QUOTE(HTMLMAL @ Apr 6 2020, 08:13 PM) *

How can i assign border styles to the image i am using for an image map without using css?

You might use the old BORDER attribute on the IMG element: https://www.w3.org/TR/html401/struct/object...adef-border-IMG (it seems to be removed in the HTML5 spec). The border color is taken from the parent element's text/foreground color.

QUOTE
<div style = "text-align:center;""border= 3px solid red"> <!-- the align part of the code is working but not the border-->

That is in fact CSS, but the syntax should be like this:

CODE
<div style="text-align:center; border: 3px solid red">

However, note that DIV is a block element, so it (and its border) will normally extend across the whole viewport.

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
HTMLMAL
post Apr 6 2020, 04:53 PM
Post #3





Group: Members
Posts: 4
Joined: 16-March 20
Member No.: 27,237



QUOTE(Christian J @ Apr 6 2020, 02:43 PM) *

QUOTE(HTMLMAL @ Apr 6 2020, 08:13 PM) *

How can i assign border styles to the image i am using for an image map without using css?

You might use the old BORDER attribute on the IMG element: https://www.w3.org/TR/html401/struct/object...adef-border-IMG (it seems to be removed in the HTML5 spec). The border color is taken from the parent element's text/foreground color.

QUOTE
<div style = "text-align:center;""border= 3px solid red"> <!-- the align part of the code is working but not the border-->

That is in fact CSS, but the syntax should be like this:

CODE
<div style="text-align:center; border: 3px solid red">

However, note that DIV is a block element, so it (and its border) will normally extend across the whole viewport.


this worked! but i have found that i needed to assign ids to elements and then style them in the style section however my issue is now centering the image i have

#mapphoto{
text-align: center; <!-- the image will not center on the page-->
border:3px solid red;
}

img id="mapphoto" src="../webpages/pictures/image_map.png" alt="Workplace" usemap="#workmap" width="768" height="614">
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Apr 6 2020, 06:13 PM
Post #4


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



QUOTE(HTMLMAL @ Apr 6 2020, 11:53 PM) *

this worked! but i have found that i needed to assign ids to elements and then style them in the style section


No, you don't have to do that.

QUOTE

however my issue is now centering the image i have

#mapphoto{
text-align: center; <!-- the image will not center on the page-->
border:3px solid red;
}

img id="mapphoto" src="../webpages/pictures/image_map.png" alt="Workplace" usemap="#workmap" width="768" height="614">


Depends on the context how you should do that best and you don't show us the context.

The way you try to do it doesn't work because you use text-align: center wrong. 'text-align' aligns text and other inline content (like images) when applied to a containing block element. You can't apply 'text-align' directly to inline elements.

Show us more of the page. Meanwhile, read this.

CSS: centering things
http://www.w3.org/Style/Examples/007/center.html

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 18th April 2024 - 09:20 PM